How JPMorgan shorted Madoff by Stephen Gandel @FortuneMagazine January 7, 2014, 10:44 PM EDT E-mail Tweet Facebook Google Plus Linkedin Share icons FORTUNE — Big banks may not be evil. But what’s becoming increasingly clear is that the bigger they are, the more evil stuff they are involved with. Hidden in the document detailing Tuesday’s settlement between the Department of Justice and JPMorgan Chase over Bernie Madoff’s Ponzi scheme was this nugget: JPMorgan was essentially shorting Madoff. In other words, it wasn’t only that JPMorgan JPM ignored and failed to report to authorities the numerous red flags its employees encountered over the 20 years it served as the main banker to the largest financial fraud in history. To be sure, JPMorgan did that. But on top of that, the bank was actually betting that Madoff was a fraud, and presumably expecting to collect when others found out. MORE: Madoff redux: Would a red flag from JPMorgan really have mattered Given that fact, it’s not much of a surprise that JPMorgan decided to settle for $1.7 billion rather than fight the charges. JPMorgan is essentially being penalized for being Madoff’s banker. But the big bank did a lot of business with Madoff over the years. It had the Madoff funds’ main bank account. It also invested in Madoff through feeder funds. And it created derivatives that it sold to people who couldn’t get into a Madoff fund but still wanted to profit from the performance of Madoff’s hedge fund. The derivatives were supposed to rise and fall with Madoff’s performance. But since it was all faked, the derivatives only rose. And people wanted them. That last bit is how JPMorgan got into the messy business of shorting Madoff, which actually was the right call, but now looks pretty bad. MORE: How Wall Street got snowed on weather derivatives It is normally very hard to short a hedge fund. Most don’t have shares that trade. And when they do, they are for the parent company and not the fund. But when you create a derivative based on a hedge fund, as JPMorgan did, you create the opportunity for a short. The buyer of the derivative is going “long,” and the seller is going “short.” And in this case, it was JPMorgan that was the seller of Madoff-linked derivatives, at one point as much as a few hundred million. For a time, JPMorgan hedged its bet, in part by putting some of the bank’s own money into Madoff-related funds. But in the fall of 2008, JPMorgan suddenly pulled nearly 80% of that money out. That left it essentially short Madoff. But it didn’t get its short right either. According to the settlement, JPMorgan bankers were worried that they were “exposed to substantial risk in the event that Madoff Securities continue to perform successfully.” Madoff, even if it was a fraud, could continue to fake his returns for a while longer. That would mean losses for JPMorgan’s short position. So they eventually decided just to get out of Madoff completely. In late 2008, the bank spent nearly $75 million canceling all the equity derivatives it had left related to Madoff, except for $5 million. It held onto that position even after finally reporting in mid-October 2008 to British authorities that it feared Madoff was a fraud. In late November 2008, just two weeks before Bernie was arrested, JPMorgan, according to the Justice Department’s settlement, got an offer to rip up that last $5 million short bet against Madoff. The bank declined, with a trader replying that they thought the short bet was “as of today … very valuable.” That was the best Madoff trade JPMorgan made; that is, until Tuesday.