The problem is not greed, as without greed there IS no economy.
The problem is greed without accountability, which is doomed to screw up the system as we are seeing.
The mortgages were indeed a product or service, this was not a violation of an economic law. If you have a promissory note, that is a valuable item. Its value depends on the likelihood of repayment. Taking large numbers of mortgages, its possible to predict very accurately what the default rate will be and therefore how much they are worth. This is why packages of mortgages were considered such "safe" investments by institutions. However, the predictions were based on assumptions that proved untrue... like the future value of the real estate, the impact of ARM rate adjustments, the ability or desire of low-income or low credit-score buyers to make payments, etc.
But it all comes back to accountability. The homeowner who decides to stop paying on a house that's worth more than he owes on it loses nothing. He passes the loss along to the bank. The bank passes the loss along to the government (which is us... taxpayers) in the form of the bailout. Our losses are socialized. When it's everyone's responsibility, it's no one's responsibility.