Donald Trump is both unapologetic about using “other people’s money” whenever possible, and proud of the way he allegedly avoided paying income tax for years by writing off nearly a billion dollars in losses, as The New York Times first reported last month. Now, a new trove of documents obtained by the Times reveals how Trump combined both of those things to wipe out his liabilities, using investors’ money to avoid reporting hundreds of millions of dollars in taxable income in the form of canceled debt on his floundering casino empire—a maneuver that even his own lawyers warned would likely get him in trouble with the I.R.S.

As has been previously reported, Trump faced a slew of crippling financial problems in the early 1990s, for which he wrote off a $916 million loss in 1995 that may have allowed him to avoid paying income taxes for nearly 20 years. (Trump, who has repeatedly refused to release his tax returns, has called these reports false, but has also bragged that finding ways to pay little or nothing in taxes “makes me smart.”) But tax experts at the time of the initial Times report were still confused as to how Trump managed to declare a loss that big.

On Monday, the Times unveiled a new analysis of the loophole Trump employed, based on newly obtained documents that were reviewed by tax experts. Under I.R.S. law, every dollar of forgiven debt is treated as taxable income, meaning that Trump should have incurred a massive income-tax bill on the hundreds of millions that he marked down as a loss in 1995. Instead, it appears Trump converted his debts into equity, offering investors Trump-issued bonds in exchange—a maneuver that pushed the limits of acceptable tax practices at the time. “Whatever loophole existed was not ‘exploited’ here, but stretched beyond any recognition,” Steven M. Rosenthal, a senior fellow at the Tax Policy Institute, told the Times.

The debt-for-equity swap was an incredible deal for Trump, as the Times explains:

The strategy, known among tax practitioners as a “stock-for-debt swap,” relies on mathematical sleight of hand. Say a company can repay only $60 million of a $100 million bank loan. If the bank forgives the remaining $40 million, the company faces a large tax bill because it will have to report that canceled $40 million debt as taxable income.