WASHINGTON -- Bank of America Corp. said Monday it had agreed to pay more than $10 billion to Fannie Mae to settle claims related to troubled mortgages sold largely by Countrywide Financial Corp. during the subprime housing boom. BofA, which acquired Calabasas-based Countrywide in 2008, said it agreed to buy back $6.75 billion in residential mortgage loans sold to Fannie Mae and pay the housing finance giant an additional $3.6 billion in cash. The mortgages were sold to Fannie Mae from 2000 through 2008. Fannie Mae and Freddie Mac, which were seized by the government in 2008 on the verge of bankruptcy triggered by bad mortgages it purchased, have been trying to get lenders to pay up for bad loans. Fannie and Freddie have said the lenders misrepresented the quality of the loans. BofA has been working to rid itself of problems it took on when it purchased Countrywide, which had been one of the nation's largest subprime lenders during the housing boom. "As we enter 2013, we sharpen our focus on serving our three customer groups and helping to move the economy forward," said BofA Chief Executive Brian Moynihan. 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. The bank's stock was up 109% in 2012, making it the best performer in the Dow Jones industrial average. BofA said the Fannie Mae settlement would reduce its pretax income for the last three months of 2012 by $2.7 billion. Despite the write-offs, BofA said Monday it expected "modestly positive" fourth quarter earnings. Monday's announcement came as BofA and at least 13 other banks worked to finalize a separate $10 billion settlement with regulators over foreclosure abuses. Bank of America voted least popular; satisfaction at 11-year low