Despite what you may read elsewhere, this was not a failure of the free market.
The backing given these companies by the federal government guaranteed their debts thereby distorting the market. When an institution is not forced to account for risk, it makes very irresponsible decisions. In this instance, the risk-less decisions made by the two mortgage lenders distorted the whole market and set us up for the problems the market now faces.
The best solution would be for the government to take control of Fannie & Freddy and break them up and sell off the various parts. This may require putting them both into some sort of receivership.
As important as solving the problem is, it is also important that people keep their heads and not lose faith in the free market. This was another government failing, not a market failure.
UPDATE 2:17pm MDT: Greg Mankiw weighed in on the bailout and for the most part, reflects the perspective I gave above--though obviously, he writes it better:
The problem is far from over, as the future of these institutions and a large segment of the financial system is still to be determined. The worrisome part is that this future will be determined by a political system that both created the GSEs and failed to provide sufficient oversight, even when many economists suggested reform was needed. To believe that the Congress will do a good job of it would be the triumph of hope over experience.This was a government problem, not a market problem.
If you have tips, questions, comments or suggestions, email me at firstname.lastname@example.org.