WASHINGTON - Freddie Mac earned $5 billion from April through June, the seventh straight profitable quarter for the mortgage giant.

The second-quarter gain reported Wednesday compares with net income of $3 billion in the same period of 2012. Freddie says its earnings were due largely to increased profits from investments made to hedge against rising interest rates. That helped offset losses on mortgages during the quarter.

Freddie, based in McLean, Va., will pay a dividend of $4.4 billion to the U.S. Treasury next month and is requesting no additional aid.

The government rescued Freddie and larger sibling Fannie Mae during the financial crisis in 2008. Together, they received loans of about $187 billion.

A housing recovery that began last year has made both profitable again. Combined, they have paid back roughly $136 billion of their government loans. Those payments are helping to make this year's federal budget deficit the smallest since President Barack Obama took office.

Once the second-quarter dividend is paid, Freddie will have repaid $41.4 billion of the roughly $71.3 billion it received from taxpayers.

Fannie and Freddie own or guarantee about half of all U.S. mortgages, worth about $5 trillion. Along with other federal agencies, they back roughly 90 per cent of new mortgages.

Fannie and Freddie don't directly make loans to borrowers. They buy mortgages from lenders, package them as bonds, guarantee them against default and sell them to investors. That helps make loans available and exert influence over the housing market.

On Tuesday, Obama proposed a broad overhaul of the U.S. mortgage finance system, including winding down Fannie and Freddie. He declared that taxpayers should never again be left "holding the bag" for the mortgage giants' risky moves.

Obama wants to replace them with a system that would put the private sector, not the government, primarily at risk for the loans. The government would still be involved, both in oversight and as a last-resort loan guarantor. Obama also wants a guarantee that private lenders will make sure homeowners have access to 30-year fixed mortgages.

A fix to the housing finance system is unlikely to be easy. Obama's plan is in line with bipartisan Senate legislation. But most House Republicans want the market almost completely privatized, while many Democrats insist on government having a larger role.

Nearly all of Freddie's second-quarter profit is going back to the government. Under a federal policy adopted last year, Fannie and Freddie must turn over their entire net worth exceeding $3 billion in each quarter to the Treasury. Freddie said its net worth in the second quarter was $7.4 billion.

Fannie earned a record $58.7 billion in the first quarter, capitalizing on tax benefits it had saved from its losses on loans during the crisis. It paid a dividend of $59.4 billion to the Treasury. Fannie has paid back roughly $95 billion of the $116 billion it received.

Freddie said Wednesday it has $28.6 billion of such tax benefits it could tap, a move that would boost its profits. Freddie CEO Donald Layton told reporters in a conference call that the company will consider applying all or a portion of those tax benefits in coming quarters.

For Fannie and Freddie, a better housing market means fewer delinquent loans on their books. The companies also are charging mortgage lenders higher fees to guarantee the loans. With more loans and higher fees, Fannie and Freddie are earning more.

Fannie and Freddie are also taking on less risk than during the pre-crisis years. That's because banks are requiring higher credit scores and larger down payments from prospective buyers.