President Donald Trump has said that paying as little in taxes as is legally required is a smart move. But that doesn't mean the president has never had to pay taxes at all. In fact, Trump's 2005 tax return reveals that he and First Lady Melania Trump paid more than $38 million in taxes that year -- and a closer look at the 1040 form shows that a single provision of the tax laws was responsible for more than 80% of the president's tax burden that year.

What President Trump owed in regular income tax: $5.3 million

President Trump's 2005 joint tax return, released by MSNBC Tuesday night, showed gross income of more than $151 million. That included $42.4 million in declared business income, $32.2 million in capital gains, and $67.4 million in rental real estate and other sources of business and investment income. The Trumps also wrote off more than $103 million, bringing their adjusted gross income down to $48.6 million.

The president's joint return claimed about $17 million in itemized deductions, bringing reported taxable income to $31.6 million. If that had been the end of the story, then the Trumps would have paid roughly $5.3 million in tax -- an effective tax rate of 17%. If that sounds low, it's because so much of the Trumps' income came from long-term capital gains, which are taxed at a much lower rate than ordinary income.

President Trump at a campaign event before his election.

Image source: DonaldJTrump.com.

The Trumps' alternative minimum tax bill: $31.3 million

But the Trumps were snagged by the alternative minimum tax provisions of the tax code, and that dramatically increased their total tax bill. The AMT in its current form was created during the Reagan administration in 1982, and the purpose of the provision was to ensure that taxpayers with high income levels wouldn't be able to use the available deductions to avoid tax entirely.

For most Americans, the provisions of the AMT that hit the hardest are those that eliminate the itemized deductions for state and local income and property tax. As residents of New York City, the Trumps would have had to pay both state and city income tax, and the property taxes on their Fifth Avenue home would likely have been substantial as well.

However, although we can only speculate because the MSNBC release didn't include the IRS Form 6251 that the Trumps would have had to file along with their 1040 return, it's likely that other provisions of the alternative minimum tax came into play to boost their overall tax liability. For instance, the AMT handles the gain and loss on certain dispositions of property differently than the regular tax system, and that could have been a consideration in real estate sales. Similarly, the AMT has different allowances for taxpayers to claim depreciation on assets, and certain loss limitations and passive activity allowances could have boosted the Trumps' income for AMT purposes significantly.

Is AMT repeal coming?

President Trump has spoken out against the alternative minimum tax, and his tax plan calls for the provision to get repealed. But the president is hardly the first Republican to call for the end of the AMT, and House Speaker Paul Ryan's tax plan also called for AMT repeal.

Interestingly, the alternative minimum tax has become more of a problem for upper-middle-class taxpayers over the years than for the extremely rich. On one hand, the AMT's exemptions went a long time without being indexed for inflation, allowing inflation to pull more taxpayers into its grasp. On the other hand, rising regular tax rates made many high-income taxpayers' ordinary income tax liability higher, making it less necessary for the AMT to kick in.

Most taxpayers will never have to deal with the alternative minimum tax. Yet President Trump's personal interactions with the AMT have cost him tens of millions of dollars. That first-hand experience puts the president's views on the tax into context in a way that is sure to generate more controversy about the fairness of the tax system and how lawmakers can best reform it.