Republican presidential candidate Donald Trump speaks at a campaign rally in Bedford, N.H. (John Locher/Associated Press)

In 1986, President Ronald Reagan and Congress came together to pass a landmark tax reform bill that streamlined tax brackets, cut rates, closed loopholes and eliminated tax breaks. Reagan declared it “a sweeping victory for fairness.”

Donald Trump, however, wanted the loopholes and tax breaks back. In testimony before a House Budget Committee task force in November 1991, Trump called the 1986 tax reform legislation an “absolute catastrophe” that had pushed the real estate business into an “absolute depression.”

To fix the situation, Trump advocated a combination of higher tax rates for the rich and the restoration of special exemptions for real estate investment. Together, they would incentivize people seeking to lower their tax bills to invest in real estate. Trump called for accelerated depreciation of property and rules that encouraged certain investors to seek out “passive losses” that could offset their other income and slash their steep tax bills. Trump cited wealthy dentists as the typical investor he hoped to attract.

The benefits became part of a suite of tax breaks that have buoyed the real estate industry and the wealthy developers behind it. The recent revelation that Trump had accumulated $916 million in net operating losses in a 1995 tax filing is a reminder that he, like others in the real estate business, has long defended and exploited targeted exemptions. There is, however, no way of knowing which provisions Trump was taking advantage of.

Now the Republican presidential nominee, Trump argues that his business experience would give him the insight to simplify the tax code and eliminate tax breaks. He has invoked Reagan’s tax legacy as a model for a new “revolution.”

Donald Trump speaks at a 1991 House hearing on U.S. Economic Recovery. (C-SPAN)

That sentiment is at odds with his 1991 House testimony, when Trump argued that the 1986 tax reform caught many developers off guard and undermined deals conceived under the previous tax rules.

“This tax act was just an absolute catastrophe for the country, for the real estate industry,” Trump said. And while economists say tax breaks distort the free market allocation of investment, Trump insisted that “we are no different right now than the Soviet Union. They have no incentive, and we have no incentive.”

He also said that tax breaks would save money for the government, which was then in the middle of bailing out the savings and loan industry, which was struggling with troubled real estate loans.

Trump appeared just four months after his Taj Mahal casino filed for bankruptcy, yet committee members praised his acumen and addressed him as the “distinguished panelist” whose “fame and reputation precede you.” The other panelists included Steven A. Wechsler, then president of the National Realty Committee, and Robert C. Baker, chief executive of the National Realty and Development Corp.

Both Democrats and Republicans in Congress responded to the industry’s complaints. Though Trump criticized the real estate industry for having “the most pathetic lobby in the history of the United States Congress,” real estate developers, brokers and lenders pressed their agenda in virtually every congressional district. Trump himself, outside the limelight of the House committee, was not particularly active.

In the Senate, Lloyd Bentsen (D-Texas) asked the Joint Committee on Taxation staff to come up with ways to channel more capital to the real estate industry, according to former staff members. In the House, Reps. Bill Thomas (R-Calif.) and Frank Guarini (D-N.J.) led efforts to bolster the real estate business. Thomas gathered more than 300 members to co-sponsor new passive loss legislation.

In 1993, a provision for passive losses became one of several new exceptions for the real estate industry adopted by Congress and signed into law by President Bill Clinton. This time, the passive loss rule applied only for real estate professionals — not for dentists as Trump had hoped. Another provision made it easier for developers to escape debts without paying more in taxes.

Steven Rosenthal, a tax lawyer who was a junior staffer on the Joint Committee on Taxation back then, said that the 1993 revisions of real estate tax provisions were “all because of the concern that the '86 pendulum had swung too far.” He added, however, that “some of what we did may have inadvertently helped Trump.”

It is impossible to know from information currently public which provisions of the tax code enabled Trump to take such a big loss and made that an attractive tax strategy.

But the disclosure of his big tax loss underlines the ebb and flow of real estate tax breaks that have been a feature of the tax code for more than half a century.

Throughout that time, the industry has effectively been heavily subsidized. At the broadest level, the real estate industry has benefited from the mortgage tax deduction, a subsidy for homeowners that will amount to $77 billion this year. And corporate borrowers, in the real estate industry as well as others that rely heavily on debt, also benefit from their ability to deduct interest they pay from their income.

Another rule dates to World War II, when Congress wanted to protect taxpayers who were being forced to sell their property to the government for military use. This rule allows taxpayers to count sales of certain kinds of property as capital gains, while counting losses against their ordinary income, which is taxed at a steeper rate than capital gains.

These days, the real estate industry is one of the main beneficiaries of this rule, which effectively protects developers who make unsound investments by partially reimbursing them for losses.

“Real estate investment has a magic, ‘Heads I win, tails you lose’ rule,” said Edward Kleinbard, a legal scholar at the University of Southern California.

On top of that, the industry has also reaped benefits from a raft of more convoluted provisions.

The 1986 tax reform was supposed to put an end to these. Before that legislation was adopted, investors frequently looked for projects that lost money so they could save more money by deducting those losses from their taxable income.

Such schemes were so widespread among affluent Americans that the joke went that “no orthodontist in America is paying tax,” Kleinbard recalled.

Not all tax shelters were in the real estate industry. Daniel Shaviro, a professor of law at New York University and a former attorney with the congressional Joint Committee on Taxation, remembers one involving the marketing of cassette videotapes of the actor Vincent Price reading passages from the Bible.

The 1986 act both altered the rules to block those investments and lowered the top tax rate to reduce the incentives for seeking such shelters. The legislation was a rare defeat for the real estate lobby. The drop in investment capital, together with the economic recession of 1990, caused widespread disruption in commercial real estate.

But some special treatment for the real estate industry remained. For instance, one rule barred investors from claiming losses from projects for which they were not personally liable, but there was an exception for realty through what were known as non-recourse loans.

The new passive loss rule adopted in 1993 restored some of real estate’s tax privileges, enabling developers to use losses from rental properties to offset gains in another unrelated project or income stream.

“That, I think, is another reflection of the power of the real estate lobby at that point,” Shaviro said.

That power remains, fueled by active lobbying. So far this year, the National Association of Realtors and its affiliates have spent more than $21 million on lobbying — more than any other entity in the country besides the U.S. Chamber of Commerce, according to Federal Election Commission data and the Center for Responsive Politics.

Although Trump pressed for the changes in his 1991 testimony, it’s not clear how much he benefited personally from the 1993 law, Shaviro said. Trump’s hotels and casinos would not have qualified as rental property. Because he was not an orthodontist paying an accountant to shelter his money from taxes but someone who was directly involved in his business, he might not have needed this exemption to claim the loss.

Trump might, however, have benefited from another odd bit of the tax code dating back to a 1980 bankruptcy reform act. Ordinarily, when investors’ debts are written down or forgiven, they must declare the forgiven debts as income and pay taxes on them.

As some of Trump’s high-profile businesses collapsed in the early 1990s, Trump’s creditors forgave hundreds of millions of dollars in debt that he owed. But instead of declaring that as income — and paying taxes on the sum — Trump might have exploited what appears to have been an oversight by lawmakers writing the rules.

Here’s one theory about how that might have worked: By playing off two sections of the tax code, Trump could have avoided declaring debt forgiveness as ordinary income. In addition, he could still have made use of the debt forgiven in calculations that could have reduced his tax liabilities somewhere down the line. (Those calculations would have increased what is known as his cost basis in those assets.) And he also would not have needed to use his massive net operating losses to offset the income from debt forgiveness — thus preserving those losses to reduce his taxes on items including real estate and appearances on “The Apprentice.”

This maneuver would have circumvented the legal obstacles Congress had tried to create against taxpayers claiming what were really lenders’ losses against their own income. The red ink would have flooded onto Trump’s personal tax return.

“All the pieces fit perfectly,” said Richard Lipton, a Chicago-based lawyer and expert on real estate taxes.

Lipton recalled a client of his who had been in a similar situation around the same time and who claimed massive losses that allowed him to avoid federal income tax for the rest of his life. While tax authorities argued that this scheme violated the intent of the tax law, Justice Clarence Thomas in a majority opinion said that it satisfied the letter of the law and that only Congress could alter it. Congress did just that, but not until 2002 and it did not apply retroactively.

No matter what Trump did with his tax returns, it’s clear that the lenders and shareholders in many of the money-losing ventures did not fare well.

“The long and the short of it is he lost other people’s money, one way or the other,” Kleinbard said. Trump would be able to avoid paying taxes on some $916 million in future income, “for the privilege of losing other people’s money.”