Fannie Mae — the much-hated, government-backed entity that needed a massive bailout and gets accused of inflating the housing bubble — just reported its biggest annual profit in history.

From the announcement that came out this morning:

Fannie Mae (FNMA/OTC) today reported annual net income of $17.2 billion for 2012 and quarterly net income of $7.6 billion for the fourth quarter of 2012, compared with a net loss of $16.9 billion for 2011. The improvement in the company’s full-year and quarterly net income was due primarily to improved credit results driven by a decline in serious delinquency rates, an increase in home prices, higher sales prices on Fannie Mae-owned properties, and the company’s resolution agreements with Bank of America.

So the comeback that we're seeing around the country in housing and credit is benefiting Fannie Mae big time.

What's more, the company is paying back the government for the huge bailout it got.

You can see in this chart that in 2012 it cut a gigantic $11.6 billion check to the Treasury, as it pays back its bailout.