How Jamie Dimon hid the $6 billion loss

July 13, 2012, 9:08 PM UTC

Whale Killer and CEO Jamie Dimon

FORTUNE — Here is perhaps the most amazing thing about JPMorgan Chase’s (JPM) $5.8 billion trading loss: Take a look at the firm’s overall results, and it’s like the London Whale’s misstep, one of the largest flubs in the history of Wall Street, never happened.

Back in mid-April, about two weeks before talk of the trading losses emerged, JPMorgan was expected to earn $1.21 a share in its second quarter. On Friday, JPMorgan reported that it had, Whale and all, earned exactly that.

How the bank appears to have offset the huge trading loss is a prime example of how complex and malleable bank profits actually are, and how much they should be believed. JPMorgan’s quarter should give fodder for accountants to talk about for some time.

MORE: Who will take JPMorgan to task?

“Yes, I have seen these results, but I have also seen how the sausage is made and I am worried that I might get food poisoning in the future,” Mike Mayo of Credit Agricole Securities  and author of the book Exile on Wall Street told Dimon in a meeting with analysts following the bank’s earnings release.

Sure some of JPMorgan’s businesses were strong. Profits in its mortgage operations, helped by falling interest rates, rose by nearly $1.3 billion. But a good deal of JPMorgan’s earnings came from some shifting of losses and an assumption that things for the bank, and the economy in general, are about to get a good deal better. That assumption might prove right, but it could also add to losses in the future.

So how do you make a nearly $6 billion loss go away? First stop taxes. The bank said that the London Whale’s blunder cost the bank $4.4 billion in the second quarter alone. But that’s before taxes. After it pays taxes, though, JPMorgan says the loss will shrink to just over $2.7 billion, which means the bank plans to take a $1.7 billion write off from Uncle Sam. Like any loss, banks are allowed to use trading blunders to offset taxable profits elsewhere in the bank. The question is the rate. At $1.7 billion, JPMorgan is writing off roughly 38% of the loss. That’s not that out of line with the U.S. corporate tax rate, but it’s a far larger percentage of profits than most companies actually pay. Nonetheless, on taxes alone, the bank was able to shrink the London Whale’s wake to $4.1 billion.

MORE: How JPMorgan made its multi-billion dollar blunder

We haven’t left the firm’s vaunted chief investment office yet. CEO Jamie Dimon has long said the portfolio is safe and that if he were to liquidate it today he could produce an $8 billion gain for the bank. In the second quarter, he dipped into some of that. London Whale aside, the CIO took a $630 million gain. Now we’re down to $3.5 billion.

Next stop loan losses. Banks have to put money away for loans they believe are going to go bad. But banks can lower their expenses by putting away less money for future loan losses. In the second quarter, the bank put away just over $200 million for future loan losses. That was not only the lowest amount the bank had set aside in any three month period since the start of the financial crisis, it was the lowest by far. A year ago, the loan loss provision was $1.8 billion.

What’s more, not only did the bank put away less money for future loans, it also pulled back money it had put away in the past. And any money you take out of your loan loss reserves the accountants let you send right to your bottom line. It appears $1.3 billion, or about 28% of the company’s total second quarter profit, came from this move, which is again only real earnings to accountants.

MORE: Wall Street’s latest sucker: Your hometown

Of course, some of this move may be justified. The bank’s loan portfolio does appear to have improved – fewer new people are telling the bank they can’t pay their loans. The question is, once again, how much. For example, in the bank’s retail business alone, JPMorgan still has $8 billion in loans in which people have stopped paying. That’s only down by 4% from a year ago. And CFO Doug Branstein told analysts not to expect any more reduction in reserves from credit cards, which means they probably took all the earnings juice they could get out of that business this quarter.

Put them together, and JPMorgan appears to have gotten a $2.9 billion boost from changes it made to its loss provisions. Impressive. Just $600 million of the Whale to go.

Now we get to the more esoteric moves. Mortgage servicing rights – the obligation that a bank takes on to collect payments and pass those along on the loans it sells to investors – are one of those assets that accountants call intangible. Banks hold those rights on their balance sheets as if they are worth something, but it’s really an obligation, and no bank could actually sell it, at least not for much. Nonetheless, JPMorgan said in the second quarter, due to improved risk management – never mind the whole robo-signing thing – the value of its mortgage servicing rights jumped by $233 million, nearly 10 times the benefit the bank got from the same accounting maneuver a year ago. And we’re down to $400 million.

Finally, the bank pulled another classic loss hiding move: Say it happened sometime else. Just before the bank released its earnings, it announced that it was restating its first quarter earnings. JPMorgan now claims more of the London Whale’s trading losses happened in the first quarter, $459 million to be exact – or just slightly more than what Dimon needed to fill the gap – than it earlier thought.

And, voila, with that, the London Whale disappeared from sight, or at least from the horizon of JPMorgan’s bottom line.

“I think they did as much manipulation as they could have to hide the loss,” says Christopher Whalen, who follows bank stocks for Tangent Capital Partners. “Some businesses were strong, but I don’t think they would have tried so hard to boost earnings if the London Whale didn’t exist.”