The financial crisis of 2008 was the result of numerous market inefficiencies, bad practices and a lack of transparency in the financial sector. Market participants were engaging in behavior that put the financial system on the brink of collapse. Historians will cite products such as CDOs or subprime mortgages as the root of the problem. However, it's one thing to create such a product, but to knowingly sell and trade these products requires moral hazard.
A moral hazard exists when a person or entity engages in risk-taking behavior based on a set of expected outcomes where another person or entity bears the costs in the event of an unfavorable outcome. A simple example of a moral hazard is drivers relying on auto insurance. It is rational to assume that fully insured drivers take more risks compared to those without insurance because, in the event of an accident, insured drivers only bear a small portion of the full cost of a collision. (See also: The Fall of the Market in the Fall of 2008)
Before the financial crisis, financial institutions' expected that regulating authorities would not allow them to fail due to the systemic risk that could spread to the rest of the economy. The institutions holding the loans that eventually contributed to the downfall were some of the largest and most important banks to businesses and consumers. There was the expectation that if a confluence of negative factors led to a crisis, the owners and management of the financial institution would receive special protection or support from the government. Otherwise known as moral hazard.
There was the presumption that some banks were so vital to the economy, they were considered "too big to fail." Given this assumption, stakeholders in the financial institutions were faced with a set of outcomes where they would not likely bear the full costs of the risks they were taking at the time. (See also: How "Too Big to Fail" Banks Will Get Even Bigger)
Another moral hazard that contributed to the financial crisis was the collateralization of questionable assets. In the years leading up the crisis, it was assumed lenders underwrote mortgages to borrowers using languid standards. Under normal circumstances, it was in the best interest of banks to lend money after thoughtful and rigorous analysis. However, given the liquidity provided by the collateralized debt market, lenders were able to relax their standards. Lenders made risky lending decisions under the assumption they would likely be able to avoid holding the debt through its entire maturity. Banks were offered the opportunity to offload a bad loan, bundled with good loans, in a secondary market through collateralized loans, thus passing on the risk of default to the buyer. Essentially, banks underwrote loans with the expectation that another party would likely bear the risk of default, creating a moral hazard and eventually contributing to the mortgage crisis.
The financial crisis of 2008 was, in part, due to unrealistic expectations of financial institutions. By accident or design - or a combination of the two - large institutions engaged in behavior where they assumed the outcome had no downside for them. By assuming the government would opt as a backstop, the banks actions were a good example of moral hazard and behavior of people and institutions who think they are given a free option.
Quasi-government agencies such as Fannie Mae and Freddie Mac offered implicit support to lenders underwriting real estate loans. These assurances influenced lenders to make risky decisions as they expected the quasi-government institutions to bear the costs of an unfavorable outcome in the event of default.