Because the banks were the ones looking at the credit reports, looking at the earnings and tax returns, looking at the appraisals, and writing loans for people who had no business buying a McMansion.
So why did they do it? Because as long as property values kept shooting up, it really didn't matter if Bob Middle Class defaulted before he could flip his McMansion. They could foreclose and sell the McMansion to the next sucker, and still collect a couple of years of interest payments and maybe even keep the downpayment!
We socialized risk and capitalized gain. And if it all went pear-shaped, the government would bail them out.