Hedge funds that made fortunes in the housing-market collapse are betting on the recovery of both Fannie Mae and Freddie Mac.

Paulson & Co. and Perry Capital are among a handful of firms that have bought preferred shares in the enterprises, which collapsed in value in 2008 after the companies were taken over by the government. 

These firms are hoping Fannie and Freddie's recent return to profitability on the back of a recovering housing market will lead the companies eventually to make payments to preferred shareholders.