Who would have believed it? Donald Trump has driven his political opponents to embrace the cause of tax reform so the wealthy have fewer loopholes to exploit. That seems to be the inescapable logic of the media and Clinton campaign’s reaction to the weekend story that Mr. Trump may have used large income losses to reduce his tax payments.

The New York Times reported Saturday that it had received an anonymous gift in the mail of three pages from three of Mr. Trump’s state tax returns from 1995. The real-estate and casino magnate, who was having well-known business problems at the time, reported a loss of $916 million on those New Jersey, New York and Connecticut returns.

The Times concludes from these losses and after consulting those it called “tax experts” that the resulting tax deduction “could have allowed him to legally avoid paying any federal income taxes for up to 18 years.” Cue the synthetic shock and outrage.

Note that word “legally.” No one, not even the Clinton campaign, is claiming Mr. Trump broke any tax laws 20 years ago. Had he done so you can bet the IRS would have noticed, since the tax agency doesn’t routinely ignore tax losses that large.

The details from three pages are scant and don’t reveal the specific tax deductions that Mr. Trump might have exploited in 1995 or other years. But even average taxpayers who declare self-employment income know that business losses are deductible, often across several years. This reflects that the cycle of business investment and sales isn’t confined to a calendar tax year.

The real-estate business is also notorious for complex accounting and depreciation practices that can reduce tax liability. Developers borrow heavily, and the interest on that debt is deductible. Mr. Trump didn’t write the tax laws he was exploiting, though President Bill Clinton did have a hand in writing them since he pushed a major tax bill through Congress in 1993 with a Democratic Congress. Maybe Hillary Clinton should blame her husband and party for tolerating such rules.

What is illegal in this story is that someone disclosed Mr. Trump’s tax returns without his permission. The Times reports that the postmark on the documents indicates they were sent from New York City, and the “return address claimed the envelope had been sent from Trump Tower.” The Trump Tower bit is probably a joke, and the sender could have traveled to New York from anywhere to send them.

But the tax-return leak was nonetheless all too predictable. The Trump campaign is attacking the newspaper for publishing the documents, but publication is not a crime. Releasing it is. The left is committed to defeating Mr. Trump by whatever means possible, and many believe this end justifies any means, much as progressives have justified the Edward Snowden leaks despite the damage to national security.

Mr. Trump also invited this October surprise by refusing to release his tax returns. Had he done so last year, when we advised him to, the debate over the details would have burned itself out. The smart play in politics is transparency to give your opponents nowhere to go.

The Clintons can count on a protective press corps to ignore or forgive their email and Clinton Foundation deceptions, but Republicans will never get that break. Mitt Romney made the same mistake by waiting to release his 2011 tax return until September 2012, and George W. Bush almost lost in 2000 when someone disclosed his drunk-driving conviction shortly before Election Day. Don’t Republicans understand that their secrets will always be exposed, and at the most damaging moment?

Mr. Trump hasn’t helped his cause by boasting about how “smart” he is for paying little tax. This is the vainglorious Trump who can’t stand to be criticized. He should be saying instead that the tax code is dumb. He could say he’s fortunate to have the means to hire lawyers and accountants who can maneuver through the tax maze to cut his payments. But he knows most Americans aren’t so lucky.

He could also say that Mrs. Clinton’s tax plans all but guarantee that the rich would pay less in taxes. She wants to raise rates, which would invite the rich to lobby Congress for more loopholes, which it would eventually pass, which would be fine for the Clintons and Donald Trump but be terrible for middle-class Americans and the economy.

Mr. Trump has made so many campaign mistakes that it’s a miracle he’s still competitive. He owes this to the fact that a majority of Americans clearly don’t want to vote for Mrs. Clinton. But the hour is late, and if he wants to win he has to stop pursuing defensive, egotistical sideshows and focus on his plans to make America better.