IN 2013 Codere, a Spanish gaming firm, owed money it could not repay. Its bonds were trading at just over half face value. Blackstone, a private-equity firm, offered it a cheap $100m loan. But there was a catch. Blackstone had bought credit derivatives on Codere’s debt that would pay out about €14m ($19m) if Codere missed a bond payment. So Codere delayed a payment by a couple of days to prompt a “technical default”. Blackstone got its payout; Codere got its loan and stayed afloat.

On the satirical “Daily Show”, Jon Stewart, the then host, likened the scheme to the insurance fraud in “Goodfellas”, in which mobsters insure a restaurant before blowing it up. But that missed an important point. Blackstone did not blow Codere up—quite the opposite. As it said at the time, it “provided capital when no one else would, which allowed the company to live and fight another day”. The investors who sold Blackstone credit-derivative contracts had in effect bet that Codere would not go bankrupt. Without the loan, it probably would have. Those investors would still have paid for their error.

Those machinations pale in comparison with Blackstone’s latest financial wizardry. In 2017 Blackstone bought $333m-worth of credit derivatives on Hovnanian, an American construction firm. It offered Hovnanian cheap financing on condition that it trigger those derivatives to pay out. But Hovnanian is in better shape than Codere. Though its bonds are junk-rated, it is hardly flirting with bankruptcy.

That posed two problems. The first is that missing a payment would harm Hovnanian’s image. But Blackstone found an ingenious workaround. A condition of the financing was that a subsidiary of Hovnanian bought $26m of its bonds. On May 1st Hovnanian paid other bondholders but defaulted on those held by the subsidiary.

The second problem is trickier. The derivatives, called credit-default swaps (CDSs), pay the difference between the notional value of a bond and the lowest price at which any of the company’s bonds is trading when the CDS is triggered. This is usually a good proxy for the haircut investors would have to take after a firm’s bankruptcy. If it can pay back only half its debt, its bonds should be trading at around half face value, and the CDS will cover the rest. That makes sense when a company actually defaults, and all bond claims fall due.

Hovnanian required a different approach. Bonds are usually issued “at par”, meaning investors get back the face value at the end of the term. In the meantime, they receive interest (the coupon). The coupon depends partly on how confident investors are that the loan will eventually be repaid in full.

If all Hovnanian’s bonds had been trading close to par, then a technical default would have resulted in a tiny payout. And indeed, most were. But Blackstone’s cheap financing took the form of buying a 22-year bond Hovnanian had recently issued with a 5% coupon—a combination of interest and term that even the bluest of blue-chips could not issue at par. Trading at less than half face value, it is the reference against which Blackstone’s CDS will be valued.

Those who must pay out are, unsurprisingly, irked. One regulator thinks they have a point. America’s Commodity Futures Trading Commission suggests technical default may count as market manipulation. But company CDSs fall under the Securities and Exchange Commission, which has said nothing. Courts, so far, have upheld the actions of Hovnanian and Blackstone. One of the CDS sellers, Solus Asset Management, a hedge fund, was denied an injunction to stop the technical default. Blackstone says it remains “highly confident” that its arrangement with Hovnanian is “fully compliant with the long-standing rules of this market”.

CDSs were intended as a hedge against losses from defaults, not a bet on a firm deciding to trigger them. But Blackstone’s machinations seem to have broken the spirit, rather than the letter, of the rules. Even Bennett Goodman, the boss of its credit-investment arm, has expressed his support for a rewrite. “If people want to change the rules…because they think it makes for a more effective market structure, we are all for it,” he said in March. That would indeed be good, fellas.