The housing recovery has led to huge profits at Fannie Mae and Freddie Mac.
The U.S. government rescued the two mortgage finance firms in September 2008. The two firms had become nearly the only source of funding for home loans, and their debt was held by banks large and small across the country. At the time, few expected taxpayers would ever be made whole.
But a recovery in housing has made Fannie (FNMA, Fortune 500) and Freddie (FMCC, Fortune 500) hugely profitable. And those profits flow to the U.S. Treasury.
Fannie Mae received a total of $116 billion in bailout funds. Thursday it reported a $10 billion profit in its most recent quarter, bringing its total repayments to $105 billion.
Freddie Mac received just over $71 billion in bailout funds. With its $5 billion profit reported Wednesday, its repayment will come to $41 billion.
Freddie also said it is getting close to a one-time gain of close to $29 billion later this year, due to how it accounts for some past tax credits. More than $25 billion of that lump sum would be paid to Treasury, which would bring repayments to $66 billion.
Related: What the end of Fannie and Freddie would mean for borrowers
Fannie and Freddie do not make mortgages themselves. Instead they buy mortgages from banks and other lenders, bundle them together and either hold them or sell them to investors with a guarantee that the mortgages will be paid.
When foreclosures shoot up as they did after the bursting of the housing bubble, both firms are subject to huge losses. And the improvement in the housing market over the past year is the key reason for the two firms' return to profitability.
In addition to fewer defaults on the trillions in mortgages they hold, the rebound in home sales has also increased the flow of business. Fannie and Freddie also benefited when record low mortgage rates earlier this year caused a spike in refinancing, which increased the fees they collect.