One way to judge the severity of a bailout is its final cost to taxpayers. So let's look at two bailouts that occurred during the financial crisis and consider the result of each. One consisted of stabilizing government-sponsored enterprises (GSEs) Fannie Mae and Freddie Mac. The other provided money to banks and insurers. These stories may have begun similarly, but they're ending very differently.

Let's start with Fannie and Freddie. They were taken into conservatorship during the financial crisis. While the cost to taxpayers was unclear at that time, in December 2009 the Treasury announced that it would not limit the size of the bailout. Today, the Federal Housing Finance Agency said that the bailout will cost taxpayers somewhere between $221 billion and $363 billion.

Now let's compare that with the bank bailout. It also made news this week. According to Bloomberg, the government's $309 billion investment has so far yielded taxpayers $25.2 billion. That's an 8.2% return. There will still likely be some losses, but earlier this month the Treasury estimated that the bank and insurer portion of the bailout will result in a net profit of $11 billion for taxpayers.

Both these bailouts were needed for essentially the same reason. Both banks and the GSEs were going to lose many billions of dollars due to bad bets related to mortgages. Taxpayers will lose between $221 billion and $363 billion through the bailout of Fannie and Freddie. Meanwhile, taxpayers will gain $11 billion through the bank and insurer bailout. How did these two bailouts have such drastically different fates?

This answer is actually pretty easy: most banks could ultimately afford their losses, particularly the large banks. They make an awful lot of money, so even tens of billions of dollars in losses over the course of several years just means a period of relatively weak earnings. The bank bailout was necessary, not to ultimately give banks lots of taxpayer money that they would keep, but to end panic and irrational fears about their survival.

With Fannie and Freddie, it was the opposite. These entities didn't have the money to back up the very large losses that they would sustain, and they never would. As a result, taxpayers won't get back the money they provide the GSEs.

In short, banks made terrible bets, but they were ultimately able to back them up after investors stopped panicking. Fannie and Freddie also made terrible bets, but unlike banks, they didn't have the capital or business model to ultimately survive -- even once the crisis had subsided.

The moral of the story here is pretty clear. Quasi-public enterprises like Fannie and Freddie don't work. The risk they take on can grow much too great, because unlike private companies, they don't need market discipline and suffer from moral hazard. Banks may have taken on a lot of risk as well, but they were able to endure it once the panic subsided.