Gene Epstein‘s latest “Economic Beat” column in Barron’s explores the president’s calculations about the benefits and deficits of free trade.

The lunacies of protectionism were put on vivid display last week via President Donald Trump’s plans for building a wall on the Mexican border.

“The U.S. has a $60 billion trade deficit with Mexico,” the president complained on Twitter. “It has been a one-sided deal from the beginning of Nafta [the 1994 trade agreement the U.S. signed with Mexico and Canada], with massive numbers of jobs and companies lost. If Mexico is unwilling to pay for the badly needed wall, then it would be better to cancel the upcoming meeting.”

That meeting, which did get canceled, was supposed to be with Mexican President Enrique Peña Nieto, who apparently did not want to contribute so much as a peso to a border wall that will probably cost tens of billions of dollars. But it was at least understandable that our president saw this deal as advantageous. Who can object to getting something for nothing? The answer: Trump himself.

Here’s why. The president believes that the $60 billion trade deficit with Mexico is a terrible thing. But if the Mexican government does pay the equivalent of, say, $20 billion for the wall, it would mean that the U.S. has imported a good from Mexico valued at that sum, while exporting nothing to Mexico in return. Hence, the trade deficit from Mexico would jump by another $20 billion.

Worse, if the Mexican government does pay for the wall, it might even insist on hiring its own domestic workers to build it. That “one-sided deal” would then become even more one-sided. Not only would our trade deficit with Mexico rise to $80 billion from $60 billion; there would be even more jobs lost, adding to the “massive numbers of jobs” already “lost.” Trade-warrior Trump could hardly permit such disastrous concessions.

A better solution: The U.S. government should pay for the wall and make sure it’s situated on Mexico’s side of the border, thus classifying it unambiguously as a U.S. export to Mexico. And of course, the work must be performed with top-dollar American labor. After all, the more expensive the project, the more the hated trade deficit with Mexico will shrink.