Over the past year and a half, famed activist investor Bill Ackman has built a massive long position in two of the most derided companies in the U.S.: Fannie Mae (NYSE: FNM-PK) and Freddie Mac (NYSE: FRE-PK).

These two government-sponsored entities were central to the subprime mortgage crisis and housing collapse that spurred the Great Recession. Why is Ackman so confident these two mortgage giants are worth an investment today, just a few short years after the crisis? Read on to find out.

A huge long position in two very risky stocks
As of the end of the first quarter, Ackman's $16 billion hedge fund, Pershing Square Capital Management, owned over $475 million worth of stock in the two government-sponsored housing entities.

Fannie represented 1.93% of the fund's investments, and Freddie an additional 1.02%. Combined, these two mortgage companies were the eighth-largest investment in the fund's portfolio.

No matter how you slice it, that's a huge investment from one of the most prolific hedge fund managers in the world. 

Any investment analysis of Fannie and Freddie must start in September 2008, when the federal government was forced to step in and place both entities into conservatorship. That action, which effectively brought both companies under complete government control, likely saved the mortgage system as we know it, but it likewise destroyed a huge amount of shareholder value.

FNMA Chart

FNMA data by YCharts.

Under the original terms of the bailout, Fannie and Freddie each issued new preferred shares that would pay a dividend of between 10% and 12% to the U.S. Treasury Department. After they failed to meet those payment requirements for the first three years under conservatorship, Treasury changed the terms in 2012. Under current terms, both Fannie and Freddie are required to pay 100% of their earnings to the U.S. Treasury as dividends.

The Treasury owns warrants on about 80% of the common stock of the two entities.

The big-picture risks and rewards
The risks inherent in owning these stocks should be obvious. The government owns 80% of the companies and forces them to pay 100% of their earnings not to common shareholders, but to the Treasury Department.

Likewise, the government clearly has little to no interest in putting a priority on shareholder concerns, evidenced by changing the terms of the preferred shares dividend from 10%-12% to 100%.

On the other hand, these two mortgage companies remain absolutely critical to the U.S. mortgage market.  No other entity comes remotely close to this level of significance and influence in the market. That's a powerful competitive advantage.

In 2006, the two GSEs held or guranateed 26% of the mortgage market in the U.S. In 2013, that number had spiked to 61%. That works out to guarantees on about $5 trillion of U.S. mortgages. That's a massive market share for just two entities. 

A gold mine in dividends
So how does Ackman intend to overcome the challenges and risks posed by these stocks? First, he thinks the government's change to a 100% payout requirement overstepped the legal limits of the conservatorship, violated the Fifth Amendment, and illegally undermined the rights of common shareholders.

The 100% dividend requirement was only instituted in 2012, which Ackman is quick to point out correlates with the two GSEs returning to profitability. Coincidence? Ackman thinks not. 

He's betting the courts will rule in favor of returning the terms of the conservatorship to the original 2008 agreement. A number of lawsuits already filed against the government have shown promise for shareholders, and Ackman thinks they will at minimum chip away at the current dividend requirement, if not revoke it entirely. 

What kind of dividends are we talking about here? Well, since 2012 Fannie and Freddie have paid over $200 billion in dividends to the Treasury, a huge sum that already exceeds the $187 billion they received in the bailout. 

FNMA Net Income (Annual) Chart

FNMA Net Income (Annual) data by YCharts.

Analysts at Pershing Square estimate that if the original 2008 bailout structure were still in place, common shareholders would have an additional $124 billion in potential dividend payouts available. That kind of cash would be a boon for shareholders, and Ackman's bet is that the courts will see to it that it happens.

The long-term bet
Because of the huge size of the U.S. mortgage industry, with its high regulatory and capital requirements forming major barriers to entry, Ackman sees Fannie and Freddie remaining as the two most critical components of the mortgage industry for the long term.

Politicians and policy experts have put forth a variety of plans to reform the structure of the mortgage industry since the financial crisis, some of which call for the dissolution of the government-sponsored entities altogether. Ackman sees those proposals as more fantasy than reality. 

Fannie and Freddie have the advantage of being already in the business, have the scale to keep financing costs lower than any other alternative, and have proven that in normal economic times they effectively support the housing sector in the U.S.

And let's not forget that they two entities together hold or guarantee 61% of the outstanding mortgages in the U.S.

If Ackman is right about industry reform, and as long as homeowners continue to finance their home purchases with mortgages, Fannie and Freddie will stand to make lots of money. Given the capital structure and operating scale between them, profits from both of these entities should translate to very attractive returns on equity.

The risks are huge, but so are the potential rewards
Is it possible that major mortgage reform could end the era of Fannie Mae and Freddie Mac? It's possible, albeit unlikely. 

Could the Treasury Department's dividend requirements survive in court? Yes, the common shareholders might lose this battle as well.

And, yes, the government to this day still controls 80% of Fannie and Freddie. With the feds running the show, the rules can change at the drop of a hat and not necessarily in favor of private investors. 

But for Bill Ackman and Pershing Square Capital, the upside of owning the two most significant companies in the U.S. mortgage industry is too much to pass up. Consider that the two stocks today trade just below $2.50 per share. Before the financial crisis each traded well above $60 per share. With even a marginal return to normalcy, the upside could be tremendous. Ackman believes that outcome is likely, and he's putting $475 million where his mouth is to back it up.