Mortgage finance giant Freddie Mac said Tuesday that three of the country’s largest banks — Wells Fargo, Citigroup and SunTrust Banks — had agreed to pay a total of $1.3 billion to resolve claims on millions of home loans that have soured or may go bad.

Freddie Mac, along with sibling Fannie Mae, has been seeking compensation from banks that it claims misrepresented the quality of home loans sold to it during the housing boom.

When the housing market crashed, homeowners defaulted on those loans en masse, saddling the mortgage finance companies with billions of dollars in losses.

“With these settlements, Freddie Mac is recouping funds effectively due to the nation’s taxpayers,” Donald H. Layton, chief executive of Freddie Mac, said in a statement. “We believe these settlements are equitable, and we are pleased to have resolved legacy repurchase issues with three of our valued customers.”

Wells Fargo, Citigroup and SunTrust are among many lenders that sell home loans to Freddie Mac and Fannie Mae, which bundle them into mortgage-backed securities and cover the losses if a homeowner defaults.

Since the government took control of Fannie and Freddie in 2008, the mortgage giants have been aggressively working to recoup losses, in part to repay the $188 billion they received in bailout funds.

Fannie and Freddie have combed through millions of loans looking for shoddy underwriting to force mortgage lenders to buy them back. The pair have focused on mortgages issued between 2005 and 2008, a boom time in the housing market and a period that has led to a high number of delinquencies and defaults.

SunTrust entered into an agreement Monday to pay Freddie Mac $65 million to settle claims that cover about 312,000 loans sold between 2000 and 2008. But SunTrust was given credit for $25 million it has already paid to Freddie for those mortgages, resulting in a cash payment of $40 million.

That agreement arrived days after Wells Fargo said it would pay $869 million to settle similar claims over some 6.7 million loans sold to Freddie between 2000 and 2008. The bank saidit would pay about $780 million after deducting what it has already paid for those mortgages.

A week before that deal, Citigroup said it would pay $395 million to Freddie to settle claims on some 3.7 million mortgages sold from 2000 to 2012. The settlement amount was adjusted by $43 million for credits related to prior loan repurchases.

Freddie Mac’s settlements largely mirror the efforts of Fannie Mae.

In July, Fannie Mae reached a $968 million settlement with Citigroup to resolve claims on 3.7 million home loans.

The deal followed an agreement Bank of America struck with the financier to spend $6.7 billion to buy back about 30,000 troubled mortgages at a discount to their original value.