The government-controlled company attributed the gain to rising home prices and fewer mortgage delinquencies.
Freddie paid a dividend of $1.8 billion to the U.S. Treasury and requested no additional federal aid.
The increase compared with a loss of $6 billion for the same quarter of 2011. It also marked the sixth quarter in which Freddie sought no additional aid since being taken over by the government in September 2008.
The gain "was driven by favorable market conditions, including the continued improvement in the housing market," Freddie CEO Donald Layton said in a statement.
The government rescued Freddie and larger sibling Fannie Mae during the 2008 financial crisis after both incurred massive losses on risky mortgages. Taxpayers have spent about $170 billion to rescue them, the costliest bailout of the 2008 financial crisis.
Under a new federal policy announced last summer, Fannie and Freddie have to turn over all profits they earn every quarter to the government. The change was made to ensure the companies pay the government back.
Freddie requested no government aid in the second quarter, after asking for $19 million in the first quarter. The company received $7.6 billion for all of 2011 and $13 billion for all of 2010.
Fannie and Freddie are required to pay 10 percent dividends on the government money they receive.
Freddie has paid more to the government in dividends than it has taken in aid over the last seven quarters, the company says.
Freddie and Washington-based Fannie own or guarantee about half of all U.S. mortgages, or nearly 31 million home loans. Those loans are worth more than $5 trillion. Along with other federal agencies, they backed nearly 90 percent of new mortgages over the past year.
(Copyright 2012 by The Associated Press. All Rights Reserved.)