Bank of America (BofA) has paid $2.8 billion to mortgage finance giants Fannie Mae and Freddie Mac to settle claims that it had sold mortgages to them that did not meet specifications.

The settlement covers the toxic mortgages sold to Fannie and Freddie by Countrywide Financial, which acquired by BofA in 2008.

The bank paid $1.28 billion to Freddie Mac as part of an agreement to end all claims, including future claims, related to mortgages sold through 2008 by Countrywide.

The bank also paid Fannie Mae $1.34 billion in cash and applied certain credits to reach an agreed $1.52 billion settlement on 12,045 Countrywide loans in the period 2004-2008. Fannie Mae has reserved the right to bring future claims against the bank.

The settlement is far less costly to BofA than many analysts had feared but it could also oblige BofA to repurchase faulty loans from Fannie Mae at a cost of up to $5.5 billion, according to an analyst who spoke to Associated Press.

Analysts had expected the banking industry to lose between $50 billion and $100 billion from settlements over bad home loans but the deal has triggered hopes that the banks like Citigroup Inc and JPMorgan Chase & Co may agree to similar settlements and pay less.

Fannie, Freddie and other mortgage finance companies have accused the banks of selling them bad loans that did not meet the investors' specifications. For instance, loans made to people who could not verify their income.

The banks' failure to meet specifications may now entitle investors to force lenders to buy back bad loans at 100 cents on the dollar, well above their market value.