My understanding is somewhat different than Shape's.
Banks loan money to people to buy homes. If a bank takes in $1B in deposits, they can loan out (in theory) up to $1B for mortgages. Once they reach that limit, they have no money to loan anymore and credit becomes non-existent. Mortgages are good investments for people with the means, so the banks can (and do) sell the loan contracts to individuals who want the negotiated interest rate in return for their investment. If the bank sold all $1B of its mortgages for $1B, it'd have another $1B to loan out.
There aren't enough individuals to sell the loans to, so Fannie Mae was created to be a market maker in these contracts. It's primary function has always been to buy mortgages from the banks so the banks have more money to lend.
Government in all its wisdom doesn't let the banks issue mortgages that make sense as contracts. They encouraged or forced the banks, by law, to issue loans to people who can't afford the payment on a traditional 30 year note. So the banks came up with ARMs (adjustable rate mortgages) that start out with a much lower payment than the traditional 30 year note would have, and the people who got those loans could only meet the qualifications for the loans based on those lower payments.
All is good in a bubble market. The home prices went up fast enough that by taking out 2nd mortgages or new loans, these buyers could borrow what they needed to make higher payments as those ARMs adjusted. The problem is that the banks were willing to loan more and more money to people who couldn't afford to service those debts, with the homes with inflated prices as the collateral. At some point, the buyers can't afford to take on any more debt and afford the payments, nor can they afford the current mortgage payment after the ARM adjustments kicked in.
It turned out to be a vicious cycle. Homes get foreclosed on, the foreclosed homes flood the market (supply/demand) driving down home prices, leaving the equity in those mortgaged properties upside down (people owe more on the home than they can sell it for). Faced with paying $500K for a $200K home, people walked away (another kind of foreclosure) leaving the banks in the upside down position. A bank can take a $300K hit on a foreclosed home here and there, but when it happens to millions of homes, the losses are devastating.
Again, the banks had sold these poor quality (high risk) mortgages to Fannie Mae, so it's ultimately Fannie Mae that took the 1M homes' worth of risk. Fannie Mae unable to buy more mortgages from the banks, leaves the banks in the position they can't lend.
Get govt. out of the business. They fucked it up all along. They're probably the only ones that can take the financial hit they caused to right things, but after this situation is resolved, they should let the banks assess risk properly and only issue loans they're comfortable doing. As it should have been all along.