Peter Wallison argues in this USA Today piece that Fannie and Freddie are to blame.

We hear all the time that it was caused by “deregulation” but a) the regulatory agency most directly involved, the Office of Federal Housing Enterprise Oversight, did warn about the looming danger of dubious mortgages in 2004 and was promptly shot down by the (bipartisan) chorus of politicians who benefited from the home ownership mania and b) given that all of those bad mortgages were written, exactly how was any regulation going to stop them from showing up on and later wrecking the balance sheets of some financial institutions?

No, this was not a failure of regulation. It was the consequence of short-sighted political meddling with the housing market.