Shares of Fannie Mae (FNMA) and Freddie Mac (FMCC) have soared over the past few weeks as investors hope these GSEs can return to private hands. With these GSEs reporting billions in quarterly profits and big name investors jumping on board, it's time to examine what the potential upside really is for Fannie and Freddie shareholders.

Common vs. preferred
For average investors, there are two main ways to invest in Fannie and Freddie: Common stock and preferred stock. Both took major hits during the mortgage meltdown and trade well below their potential values due to the GSEs' arrangements with the government.

The upside for preferred shares is easier to calculate. Like other preferred stocks, Fannie and Freddie preferreds have liquidation values that give a fair estimate of their value in a situation where dividends are being paid. The most liquid preferreds trade with liquidation values of $25 and $50 giving them the potential to nearly triple in the event the GSEs can return to private ownership.

The value of the common stock, however, is more difficult to calculate -- but with currently available information, we can get a general estimate.

Earnings view
Current headlines show that Fannie Mae reported a profit of $84 billion for 2013 however that figure is not a good way to measure company value. The $84 billion is largely driven by the recognition of deferred tax assets, a one-time event rather than a recurring one. A more accurate picture would come from excluding the $50.6 billion gain from the deferred tax assets resulting in $33.4 billion in net income for 2013.

Freddie Mac received a similar benefit from the recognition of deferred tax assets. Subtracting the $30.4 billion DTA gain from Freddie's $48.7 billion in net income gives a figure of $18.3 billion.

Both GSEs have benefited (and could still benefit in the future) from legal settlements with the banks that sold Fannie and Freddie the defective mortgages before the crisis. But since the settlements are not going to be a perpetual part of income, I will discount 30% from future estimated income.

Applying a 10 times price to earnings ratio to these settlement-adjusted earnings would give Fannie Mae a market cap of $234 billion and Freddie Mac a market cap of $128 billion. Investors also need to factor in the warrants owned by the Treasury to acquire 79.9% of Fannie and Freddie's common shares. With these warrants exercised, Fannie's shares outstanding would rise to 6.0 billion and Freddie's would rise to 3.3 billion.

Taking these market caps divided by these shares outstanding yields an estimate of $39 for Fannie Mae shares and $38.79 for Freddie Mac shares. Of course these are just rough estimates -- a more realistic prediction would be that shares of the GSEs could reach the upper $30 to lower $40 range.

Book value?
Looking at other financial institutions book value can be a good indicator for assessing over or under valuation. For example, one of the core arguments for being bullish on Bank of America (BAC -0.53%) is the bank's discount to book value. The idea here stems from that if the market regains confidence in the bank and sees a larger dividend, shares should move toward the bank's book value.

However, Fannie and Freddie have a major difference from Bank of America since the GSEs have to turn over their profits on a quarterly basis to the government. B of A, on the other hand, can retain, reinvest, and distribute earnings as dividends.

For this reason, it's better to look at the GSEs on an earnings basis rather than a book value basis, like investors would value other large financial companies.

Upside and risk
With billions in quarterly earnings, shares of Fannie and Freddie have major upside if the lawsuits to end the Sweep Amendment are successful. Bill Ackman, manager of Pershing Square, has made a major investment in the common stock of both GSEs and recently talked of returns of 10 to 15 times the current value.

Shares of the GSEs were lower when Ackman made the comment last week, but the potential for multibagger upside still remains. By looking at the GSEs earnings, excluding one-time DTA gains and reducing them to factor out legal settlement gains,  I have found potential upside to nearly $40 per share at each GSE, largely in line with Ackman's estimates. For investors who can afford to lose their investment if things go bad, Fannie and Freddie still offer some of the greatest potential gains in the market today.