Bloomberg is out with a telling report on how Goldman Sachs helped Greece set up a secret loan swap deal in 2001 that helped the country hide its debt levels in order to meet requirements to join the European Union.

The deal has been called a "very sexy story between two sinners" by former head of Greece's Public Debt Management Agency, Christoforos Sardelis, because of the intentions of the two parties involved—Greece was trying to cover up its high debt levels and Goldman Sachs was trying to make a profit.

And what a profit Goldman made—according to Bloomberg, the Greek government already owed the bank $793 million on the day the deal was inked in 2001.

Here's a rundown of how the loan worked from Bloomberg:

The Goldman Sachs transaction swapped debt issued by Greece in dollars and yen for euros using an historical exchange rate, a mechanism that implied a reduction in debt, Sardelis said. It also used an off-market interest-rate swap to repay the loan. Those swaps allow counterparties to exchange two forms of interest payment, such as fixed or floating rates, referenced to a notional amount of debt.

The trading costs on the swap rose because the deal had a notional value of more than 15 billion euros, more than the amount of the loan itself, said a former Greek official with knowledge of the transaction who asked not to be identified because the pricing was private. The size and complexity of the deal meant that Goldman Sachs charged proportionately higher trading fees than for deals of a more standard size and structure, he said.

The complexity of the deal helped Goldman reap a bigger payday—but in fact, the loan was so confusing that even the Greece government had trouble understanding it and thought it was much cheaper than it actually was. Officials admitted later it was a "very bad bet," according to Bloomberg.

Risk consultant Satyajit Das breaks down the situation pretty well with this quote to Bloomberg: “Like the municipalities, Greece is just another example of a poorly-governed client that got taken apart ... These trades are structured not to be unwound, and Goldman is ruthless about ensuring that its interests aren’t compromised — it’s part of the DNA of that organization.”

Read the full Bloomberg report here >