Bank of America (NYSE:BAC) said Monday it will pay $3.6 billion to government-chartered mortgage giant Fannie Mae and spend about $7 billion more to end liabilities it is facing from the activities of subprime lender Countrywide Financial Corp., which BoA bought in 2008.

The agreements with Fannie Mae cover $11.2 billion in claims by Washington-based Fannie Mae. The claims arise from a total of $1.4 billion in loans, which have a current outstanding balance due of about $300 billion that were made from 2000 to 2008 by Countrywide, when it was being run by Angelo R. Mozilo, and also Bank of America National Association.

In addition to the $3.6 billion payment, Bank of America agreed to:

- Sell to Walter Investment Management Corp. and Nationstar Mortgage Holdings LLC the servicing rights on 2 million residential mortgages totaling approximately $306 billion;

- Repurchase for $6.75 billion certain residential mortgage loans sold to Fannie Mae, which Bank of America has valued at less than the purchase price; and

- Make a cash payment to Fannie Mae to settle Fannie Mae’s outstanding and future claims for fees caused by past foreclosure delays. This payment is expected to be covered by existing reserves and an additional provision of $260 million (pretax) recorded in the fourth quarter of 2012.

Together, the actions announced Monday are expected to reduce Bank of America’s pretax income by approximately $2.7 billion in the fourth quarter of 2012. The bank expects to cover the cost of the settlement actions through existing reserves plus an additional $2.5 billion (pretax) in representations and warranties provision recorded in the fourth quarter of 2012.

“These agreements are a significant step in resolving our remaining legacy mortgage issues, further streamlining and simplifying the company and reducing expenses over time,” bank CEO Brian Moynihan said in a statement.