NEW YORK -- Bank of America will pay $10.3 billion to the government mortgage agency Fannie Mae to settle claims resulting from mortgage-backed investments that soured during the housing crash.

Under the deal announced Monday, Bank of America will pay $3.6 billion in cash to Fannie Mae and buy back $6.75 billion in loans that the bank and its Countrywide Financial unit sold to the agency from Jan. 1, 2000 through Dec. 31, 2008. That includes about 30,000 loans.

Also Monday, a separate settlement was announced between federal regulators and ten major banks and mortgage companies, including Bank of America, over wrongful foreclosure practices. That $8.5 billion settlement covers up to 3.8 million people who were in foreclosure in 2009 and 2010. Of those, about 400,000 may be entitled to payments, advocates estimate.

For Bank of America, its own settlement with Fannie Mae over the mortgage investments represents a "a significant step" in resolving the bank's remaining mortgage problems while also streamlining the company and reducing future expenses, Bank of America CEO Brian Moynihan said in a statement. Moynihan's predecessor, Ken Lewis, bought Countrywide, a troubled mortgage-lending giant, in July 2008 just as the financial crisis was taking hold.

The bank's acquisition of Countrywide was initially praised by lawmakers. Bank of America was seen as stepping in to eliminate a bad actor from the mortgage market. But instead of boosting Bank of America's mortgage business, the purchase has drawn a drumbeat of regulatory fines, lawsuits and losses.

Bank of America also agreed in September to pay $2.43 billion to settle a class-action lawsuit related to its takeover of Merrill Lynch, another of Lewis's acquisitions during the financial crisis. That lawsuit was filed on behalf of investors who bought or held Bank of America stock when the company announced its plans to buy Merrill Lynch in a $20 billion deal as the banking industry and federal regulators struggled to contain fallout from the financial crisis in the fall of 2008.

The North Carolina-based bank said it would pay for the Fannie Mae settlement in part from existing reserves. Bank of America also said it would record a $2.7 billion hit to its fourth quarter earnings for 2012.

Despite the cost of the settlement, Bank of America still expects its earnings for the period to be "modestly positive," aided by a tax credit and an improvement in the valuation of its debt. Analysts are currently forecasting that the bank will report earnings per share of 19 cents, according to estimates compiled by data provider FactSet. Bank of America is scheduled to report earnings Jan. 17.

Bank of America fell 8 cents to $12.01 Monday, after opening slightly higher. The stock more than doubled in 2012, making it the best performer in the 30-member Dow Jones industrial average. It's up 3.7 percent this year.

Fannie Mae and Freddie Mac, which packaged loans into securities and sold them to investors, were effectively nationalized in 2008 when they nearly collapsed under the weight of their mortgage losses.

"Fannie Mae has diligently pursued repurchases on loans that did not meet our standards at the time of origination, and we are pleased to have reached an appropriate agreement to collect on these repurchase requests," Bradley Lerman, Fannie Mae executive vice president and general counsel, said in a statement.

Bank of America also said that it is selling mortgage servicing rights on about 2 million residential mortgage loans. The loans have an aggregate unpaid principal balance of approximately $306 billion.

The transferring of the servicing rights is expected to take place throughout the year.