On a Monday morning five years ago this week, thousands of employees at mortgage giants Fannie Mae and Freddie Mac went to work to find a new boss: The federal government.
Crushed under the weight of thousands of defaulted mortgages and bleeding cash, Fannie Mae and Freddie Mac were put into government conservatorship.
Now, a short five years later, the two are making billions of dollars in profit—profit that goes straight to the U.S. Treasury. Against this backdrop, lawmakers are setting the stage for an epic debate on the future of U.S. housing finance, a future that will likely mean the end of Fannie Mae and Freddie Mac.
"Everyone gets so caught up in their profitability, but everyone forgets that profitability is tied to their direct government support," said Jaret Seiberg of Guggenheim Partners.
That's why the debate over government involvement in the mortgage market is so fierce. Lawmakers are eager to protect taxpayers, but they also need to keep home finance afloat. How do you "wind down" two entities that now back two thirds of the U.S. mortgage market? And how do members of Congress reconcile that goal with the fact that the two are now huge cash cows? In order to look forward, it is essential to understand how we got here.
After Fannie and Freddie were put into conservatorship, the Treasury began buying senior preferred shares of stock in the two, thereby keeping them afloat and fueling the nation's mortgage market for the foreseeable future.
During the next several years, as the housing market crashed and then began to eke its way back, Fannie and Freddie drew $188 billion from the Treasury. They were in turn forced to pay 10 percent stock dividends back. Then in 2012, the Treasury announced that that agreement would be replaced by a quarterly sweep of every dollar of profit that each institution earned in the future.
(Read more: Map: Tracking the recovery)
The move was designed to, "help expedite the wind down of Fannie Mae and Freddie Mac, make sure that every dollar of earnings each firm generates is used to benefit taxpayers, and support the continued flow of mortgage credit during a responsible transition to a reformed housing finance market," went the 2012 release.
By 2012, with the housing market rebounding and newly originated loans faring better than any in history, Fannie Mae and Freddie Mac began turning annual profits. By 2013, those profits were growing dynamically, and the two are now nearing the amount they originally drew from the Treasury, although the payments do not go to pay back the draw. The Treasury still owns the preferred stock. The money simply goes to the government.
Now, as individual investors in Fannie and Freddie stock cry foul, launching lawsuits against the government and demanding their share, lawmakers are under increased pressure to find a fitting end for the conservatorship and the entities. The question is whether or not to put a government backstop into the market yet again.
"The construct of a government-guaranteed, mortgage-backed security is absolutely going to be needed," said David Stevens, CEO of the Mortgage Bankers Association. "You can't have a functioning housing finance system where private capital just leaves it in the next recession. You need to have constant liquidity provided to the U.S. system, and that comes from the guaranteed mortgage-backed security."
Confidence is key going forward, and investors are unlikely to pour money back into the mortgage market without a guarantee that in another catastrophic crash there won't be some government backstop. One of the leading bipartisan proposals in Congress, introduced by Sens. Bob Corker, R-Tenn., and Mark Warner, D-Va., does create an investor and borrower-funded backstop. It will make loans slightly more costly, but the government guarantee on mortgage-backed securities would be there.
"The biggest problem is that Congress wants supercheap mortgages and they want to eliminate taxpayer risk for the housing market, and that's just a holy grail to get," said Guggenheim's Seiberg. "Anything less than 100 percent government backstop is going to raise questions about whether fixed income investors are really going to be there to pick up the slack and to buy those securities."
Federal regulators are already trying to shrink the portfolios of Fannie Mae and Freddie Mac, even as Congress still debates their future. They have layered on heavy fees to lenders, which have actually made conforming loans (those backed by Fannie and Freddie) more costly than jumbo loans funded by banks. There is also a move to lower the loan limits on conforming loans, which would push banks and investors to take on more of the markets.
(Read more: Jobs report tempers mortgage rates)
Government-backed loans, which also include those insured by the FHA, now make up 90 percent of the all mortgage originations. While investors are slowly coming back to the jumbo market, they are nowhere to be found in the nongovernment-backed conforming market. There is plenty of cash on the sidelines; what is lacking is confidence.
(Read more: Millions still drowning in debt)
"It's essential that the government is involved, both because that encourages lenders to be more creative, and that benefits the market and because it assures us that people in underserved communities will have access to lending going forward," said Alys Cohen of the National Consumer Law Center. "That's been a huge problem in the past, and we need to make sure that banks and investors are interested in serving all parts of the market and doing it in a way that's sustainable to everybody."
While lawmakers are positioned to take on the future of mortgage finance this fall, they could be sidetracked yet again by troubles in Syria and by the so-called "fiscal cliff" budget crisis. Should they finally agree on a plan, it is not as if Fannie Mae and Freddie Mac can just close their doors overnight. The two employ thousands of workers and have valuable infrastructures and knowledge bases.
"You can keep that core infrastructure and protect it in its future state and have a transition that is virtually seamless to the American homeowner but creates a safer system going forward," said Stevens.
The devil, of course, will be in details that will be many years in the making.
—By CNBC's Diana Olick. Follow her on Twitter @Diana_Olick.