It’s been the question on everyone’s mind ever since we set eyes on Trump’s 1995 tax return: How in the world did Trump suffer business losses of $916 million and live to tell the tale?

A new theory floating around among tax experts is complicated, but it offers a plausible scenario for how Trump may have been able to convert those huge operating losses into big, years-long breaks on his personal income taxes.

According to a column in the publication Tax Notes written by Lee Shepard and flagged by Business Insider, there was a pretty aggressive tax loophole at the time that may have allowed Trump to take his business losses on his personal income taxes even if he hadn’t actually incurred those losses himself.

“Trump may have benefited greatly in the 1990s from a tax loophole related to forgiven debts — a loophole that would have allowed him to deduct business losses on his personal income tax return, even if those losses were actually borne by banks that loaned Trump money and never got it back,” Business Insider’s Josh Barro wrote.

As Barro notes, this wasn’t a lobbyist-driven loophole, carved out for special interests, like so many provisions in the tax code. It was an error in the way the law was written. A mistake.

The tax loophole was controversial, but it was taken advantage of by tax advisers at the time. Eventually, the Supreme Court ruled in Gitlitz v. Commissioner that the law was clear, even if it may have been written incorrectly. It was up to Congress to fix the law. In 2002 it closed the loophole. Sen. Hillary Clinton (D-NY) was among those voting to close it.

So how exactly could it have helped Trump?

Here’s how Barro explained it:

“Sheppard sketches out a situation in which an S Corporation owned by Trump is the general partner in his casino businesses, which went into bankruptcy in 1991 and 1992. That S Corporation likely lost a great deal of money. It also likely owed debts related to the casino businesses that it could not pay and that were canceled as part of the bankruptcies — and/or as part of Trump’s subsequent out-of-bankruptcy restructurings, which continued into 1995. Ordinarily, canceled debts would count as taxable income to the S Corporation. But if the S Corporation were insolvent (which you would have expected it to be, if its sole assets were its equity interests in Trump’s bankrupt casinos), the debt cancellation would have been excluded from its taxable income.”

Tax experts who spoke with TPM said that there is no definitive proof that this loophole was how Trump was able to report such massive losses without actually incurring them. We would need to see an actual tax filing to verify that, and of course he continues to refuse to makes his tax returns public. The theory also presumes that there was a Trump-affiliated S corporation that passed these massive losses through to Trump.

However, Richard Lipton, a tax lawyer in Chicago who was familiar with the contentious loophole and actually advised a client to use it at one point, said that it would have been odd for Trump not to have used an S corporation at the time. Lipton said, for him, the theory checked out.

“It is an extremely strong, educated guess because all the pieces fit,” Lipton said. “If he used an S corporation, the rest is just the way the law worked.”

Correction: Due to an editing error, the original headline on this post misstated the amount of income taxes Trump may have avoided paying. We regret the error.