Bank of America (BAC) will pay Fannie Mae $3.6 billion to settle claims in connection with mortgage loans the bank sold to Fannie over a nine-year period starting in January 2000.

The nation's second-biggest bank by assets said Monday that it also would buy back $6.75 billion in residential mortgage loans the bank sold to Fannie.

B of A also announced it would sell servicing rights on mortgage loans totaling roughly $306 billion to two unnamed investors whom Reuters has identified as Nationstar Mortgage and Walter Investment Management Corp.

"Together, these agreements are a significant step in resolving our remaining legacy mortgage issues, further streamlining and simplifying the company and reducing expenses over time," Brian Moynihan, B of A's chief executive, said in a news release.

The settlement follows demands by Fannie that the bank repurchase loans that, Fannie alleged, had failed to follow its underwriting standards despite the bank's representations to the contrary.

"A favorable resolution of this long-standing dispute between Fannie Mae and Bank of America is in the best interest of taxpayers," Bradley Lerman, Fannie Mae's general counsel, said in a news release. "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."

The agreement, which Fannie said resolves its current and future repurchase requests, covers single-family loans that were originated by B of A and Countrywide, the failed mortgage lender the bank acquired in 2008. The loans had an outstanding unpaid principal balance of $297 billion as of Nov. 30.

B of A said it would add $2.5 billion to existing reserves to cover the cost of the settlement, which is expected to reduce the bank's income before taxes by roughly $2.7 billion in the fourth quarter of 2012.

Subscribe Now

Access to authoritative analysis and perspective and our data-driven report series.

14-Day Free Trial

No credit card required. Complete access to articles, breaking news and industry data.