The revelation on Saturday that Donald J. Trump, the Republican presidential nominee, could have avoided paying taxes on nearly a billion dollars in income over two decades drew criticism and commentary from around the country. Democrats seized on the news to discredit Mr. Trump’s supposed business acumen — the tax opportunity stemmed from a $916 million business loss in 1995 — and criticized his commitment to working-class taxpayers. But Mr. Trump’s campaign and his allies were quick to defend his tax avoidance: Only a genius businessman, they said, could have worked the tax code to such advantage.

Yet as Mr. Trump’s voluminous social media record shows, Mr. Trump has taken to Twitter many times in the past several years to denounce tax avoiders, complain about misuse of his own tax dollars and warn of the significant pain that paying taxes had caused him or others.

‘Class Warfare’

In 2011, Mr. Trump criticized President Obama for a speech in Kansas about income inequality, calling it “class warfare.” The worst part, Mr. Trump said, was that Mr. Obama’s speech had been paid for with “our tax dollars.”