To profit from property inspections, title searches and maintenance on homes going through foreclosure, Countrywide set up subsidiaries to do the work and marked up the cost of the services by more than 100 percent. The company’s strategy was aimed at increasing profits from default-related services during bad economic times, the trade commission said. Some troubled borrowers were charged $300 by Countrywide to mow their lawns, for example.

An additional 102,331 people will share in the settlement because Countrywide gave them incorrect figures about how much they owed on their mortgages or added fees and escrow charges without notice, the trade commission said. Because these borrowers had filed Chapter 13 bankruptcies to try to keep their homes, the erroneous amounts supplied by Countrywide were also filed with the courts. Of these borrowers, about 43,000 were charged improper fees that Countrywide levied after their bankruptcies had been concluded and they were no longer under court supervision.

The recipients under the settlement are borrowers whose loans were serviced by Countrywide between Jan. 1, 2005, and July 1, 2008. In addition to being the nation’s largest mortgage lender, Countrywide was the biggest loan servicer, administering $1.4 trillion in mortgages. Countrywide nearly collapsed under the weight of its subprime lending, however, and was acquired in a fire sale by Bank of America in 2008.

It took more than a year to identify all of the borrowers injured by Countrywide’s practices because the company’s records were completely disorganized and chaotic, according to people briefed on the investigation. After the deal was struck, Bank of America was given 30 days to provide the F.T.C. with a list of borrowers who had been overcharged. The company failed to meet the deadline and its later assessments of those who had been victimized were found to be incomplete.

Ultimately, Bank of America had to hire an accounting firm to determine that it had correctly identified all the borrowers who were owed money.