Analyst downgrades. Worse-than-expected earnings. The lifting of federal loan limits. Put it all together, and Fannie Mae (NYSE:FNM) and Freddie Mac (NYSE:FRE) have experienced one of the most tumultuous weeks in their history.

But is there opportunity amid the storm? Does one dare buy?

Merrill Lynch (NYSE:MER) is apparently attempting a role reversal, from main contributor to the mortgage industry's problems to ardent critic of those same problems. In this vein, the company downgraded Fannie and Freddie last Friday. Merrill lowered its rating to "sell," saying the stocks don't "fully reflect the severity or duration of the financial headwinds facing the companies." 

Then, on Monday, Goldman Sachs (NYSE:GS) chimed in with downgrades of the mortgage lenders, saying that the U.S. is only "halfway" through this "severe housing cycle." Both Goldman and Merrill forecast much higher losses than expected. Some wondered whether these downgrades were justified, or perhaps overly pessimistic.

Wall Street's right
This week, FNM and FRE reported earnings that proved Wall Street's skepticism not only correct, but also insufficient. Fannie announced a loss of $3.6 billion, or $3.80 per share, for the fourth quarter. These numbers more than doubled the third-quarter loss and almost tripled the fourth-quarter per-share loss projected by analysts polled by Thomson Financial. Freddie followed suit on Thursday by reporting a $3.97-per-share fourth-quarter loss, much steeper than expected, and a $2.5 billion loss overall.

How could this be?
The mortgage lenders lost money because of higher losses resulting from defaults. In the current environment, more borrowers are falling behind, and home prices are falling. But Fannie also attributed 90% of is losses to bad interest rate bets. FNM invested in complex financial instruments in order to hedge its portfolio against interest rate risk. When interest rates decline, the value of mortgage portfolios is supposed to increase. Unfortunately, thanks to the current environment, it didn't work out that way. Oops!

Losses at FNM and FRE aren't nearly as bad as those at Merrill Lynch, Citigroup (NYSE:C), and UBS (NYSE:UBS), because Fannie and Freddie never took as much risk (and rightfully so, since they are government-sponsored). But these recent numbers are an ominous reminder of the spread of the credit crunch into the balance sheets of even the best financial companies.

What does all this mean?
FNM and FRE are federally chartered corporations. They don't lend money directly to homebuyers. Instead, they purchase loans, conforming to certain guidelines, from originating lenders in the secondary market. Fannie and Freddie truly prime the pump for mortgage and homebuying activity by providing lenders with an easy place to sell their loans, and giving investors an implied government guarantee.

This week's numbers show that FNM and FRE are getting sick. Unfortunately, they can't get sick, because they're the only way the housing market can recover. Without a strong Fannie and Freddie presence, buyers are scarce because of higher interest rates, and lenders -- already reeling from defaults and foreclosures -- are reluctant to make new loans they can't unload. And investors aren't likely to buy mortgage loans without the implied guarantee. It would be nearly impossible for the housing market to recover without FNM and FRE consistently buying loans. It's also nearly impossible for the overall economy to recover without an improving housing market.

This week, the government attempted to address that very problem by lifting the federal loan limits set earlier this decade to provide an investment portfolio cap for FNM and FRE. This should free up billions more for mortgages. The government is attempting to help the mortgage lenders support the ailing housing market.

What's an investor to do?
In 2003, my 85-year-old uncle had the gumption to buy the major airlines when no one would touch them. His rationale was simple: The country can't function without the airlines. He profited greatly over the following years.

Over the past 12 months, FNM is down 54% and FRE is down 61%. The companies endured a sea of downgrades at the end of 2007. This week, there was another spate of downgrades. The housing slump may have a ways to go. We may only be in the middle of it. Right now, no one seems to want to buy FNM or FRE. But can the country function without a housing market?