Jamie Dimon was right about one thing: The embarrassing $3-billion-and-counting trading loss at JPMorgan Chase has played right into the hands of pundits who think Wall Street needs to be put on a shorter leash.

Honestly, we pundits probably couldn’t have made up a better story than this one:

A secretive trading operation whose ostensible purpose is to hedge risks that actually makes a quarter of the giant bank’s total profits doing just the opposite.

A cocky London derivatives trader with the nickname of Voldemort who overplays his hand and finds himself squeezed by a couple of hedge fund sharks who pocket tens of millions of dollars profiting from his miscalculation.

Risk management models that were flawed and risk managers who were ignored.

Press warnings that were dismissed as a “tempest in a teapot” by a celebrity chief executive who seems to have been unaware of the risk in a $100 billion trading position.

And all of it going on right there under the noses of resident bank examiners desperate to show they won’t let it happen again.

So much for the idea that the greatest threat to the financial system is overzealous government regulation.

Aside from the embarrassment and the short-term financial hit, the real damage to JPMorgan is that it exposed how the big Wall Street banks were planning to get around the new Volcker rule, by which Congress meant to prevent the too-big-to-fail banks from taking hedge-fund-like risks with their own capital or borrowed money. Rather than running these trades through their old “proprietary trading desks,” which used to generate a majority of their profits, the Volcker work-around plan would disguise such trading as part of the bank’s normal hedging operations.

The banks had taken great care to get the hedging exemption written explicitly into the legislation. And until last week at least they were in the process of muscling regulators into adopting the broadest possible interpretation, one that would not only allow them to hedge risks associated with individual loans and securities but also broad “structural risks” running through the bank’s balance sheet. According to the Federal Reserve’s official description, that was the focus of a meeting between its Volcker rule writers and six top JPMorgan executives who traveled to Washington on Feb. 22. Included in the delegation was Ina Drew, the now-departed executive who ran the now-famous chief investment office.

It is this exemption that would allow Drew and her team to hedge the credit risk on the bank’s unusually large portfolio of corporate bonds by purchasing a “synthetic” derivatives instrument whose value would go up when a widely-traded index of more than 120 blue-chip corporate bonds went down-or vice versa. But it was also broad enough that it would make it possible for them to later hedge their original hedge and move aggressively to take the other side of the bet.

In their rush to switch gears and sell rather than buy risk protection using these new derivatives contracts, however, the JPMorgan crew apparently wound up driving the price of insuring the entire index below the price of protecting the individual corporate bonds that make up the index. That rang a bell at a number of hedge funds that are constantly trolling the market for a chance to make a quick buck from such discrepancies by buying one and selling the other. Their profitable arbitrage had the effect of driving down the market value of JPMorgan’s positions, which under accounting rules required the bank to post a giant paper loss. The bank’s position was so large that it could not begin to unwind it without driving down the price even further.

One of the things to notice about this tale is that the change in the prices of these derivative instruments had little if anything to do with any change in the value of corporate bonds or the number of bonds that went into default. Nor do most of the entities buying the “insurance” actually own the underlying index or the individual bonds that make up the index. The explanation is a simple one: It all has very little to do with hedging and a lot to do with gambling.

I’ll leave to other pundits the question of whether banks should be speculating in credit derivative markets. For me, the more interesting question is why these markets exist in the first place. What useful social or economic purpose do they serve?

To hear it from the financial services industry and its loyal cadre of academic cheerleaders, the reason we need trillions of dollars in credit default swaps is that they lower the cost of borrowing for corporations and households. By making it possible to “hedge” risks, the derivatives make investors more willing to buy bonds and banks more willing to buy and make loans, thereby increasing supply and lowering the cost of borrowed money. Or at least that’s the theory.

But a 2007 paper by Adam Ashcraft and Joao Santos, two researchers at the Federal Reserve Bank of New York — JPMorgan’s chief regulator — concludes that it ain’t necessarily so.

“We find no evidence that the onset of [credit default swap] trading affects the cost of debt financing for the average borrower,” Ashcraft and Santos write.

It turns out that the swaps actually may lower borrowing costs by 15 to 20 basis points for a handful of large blue-chip companies considered the safest and most transparent — that’s a difference of less than a fifth of a percentage point in the interest rate. But the researchers found that for all corporate borrowers, credit default swaps raised borrowing costs for the average firm by 20 basis points. For the riskiest firms — those that are typically the newest and least understood — the rate was 40 basis points higher.

And why would that be? According to Ashcraft and Santos, it’s because the market knows that the lead bank, or the lead underwriter, can use credit default swaps to hedge their own risks, which makes other banks and investors less confident that the loan was carefully underwritten in the first place.

This moral hazard, as economists refer to it, ought to sound somewhat familiar. After all, it was at the heart of the recent financial crisis, which as you’ll recall resulted from too many loans having been made without sufficient care to too many borrowers who never should have qualified for them at interest rates too low to reflect the risk that they would not be repaid. What gave banks and finance companies and investors the confidence to make and hold such loans was their ability to sell off the loans through the shadow banking system or hedge the risk of holding them through the credit derivatives market.

But the damage caused by credit default swaps goes beyond the issue of moral hazard and its effect on the cost of borrowed money. This market also ties up hundreds of billions of dollars of the world’s capital — capital that could otherwise be used to actually finance real businesses that could create wealth and jobs and new products and services.

It also represents a massive waste and misallocation of some of the world’s brightest, most skilled workers who are lured in part by the outsize salaries and bonuses that the imperfectly-competitive financial markets now offer. Imagine how much more vibrant and innovative the economy might be if all those Wall Street “rocket scientists” were actually designing rockets and all those hedge fund traders were channeling their entrepreneurial risk-taking into starting new companies.

For this pundit, the lesson to be drawn from JPMorgan’s trading blunder is not that banks have become too big to manage or even too big to hedge. It is that banking and finance have become too detached from the real economy they were meant to serve.