This new tax would sit atop Mr. Trump’s tariffs on aluminum and steel imports, and Mr. Trump’s tariffs on Chinese imports, and the bill is adding up. The United States so far has collected about $19 billion in Trump tariffs. A full 25 percent tariff on Mexican goods could add as much as $87 billion a year to that total.

Mexico would most likely respond by imposing retaliatory tariffs, which is especially bad news for the probable targets: American farmers. About two weeks ago Mr. Trump ended a tariff on Mexican aluminum and steel, and Mexico ended a tariff on American farm goods. So much for that false dawn. Farmers may need to resume the search for new markets.

Taxation is always painful, and always the question is whether the benefits outweigh the pain. In this case, Mr. Trump is using a tariff as a cudgel to induce Mexico’s cooperation in keeping immigrants from America’s southern border. While the cost of the tariff would be paid by Americans, the Mexican economy most likely also would suffer a loss of sales to the United States.

Mr. Trump might succeed in pressuring Mexico to take stronger steps on immigration. Tariffs, however, are a very crude tool. Most of the immigrants seeking to cross the southern border are fleeing problems in Central America that are beyond the control of the Mexican government. Moreover, while Mr. Trump tends to refer to all of the immigrants as illegal, many are exercising a legal right to seek asylum.

Past administrations have sought cooperation from Mexico on immigration issues without disrupting economic relations between the two countries. Mr. Trump's decision to mix the two issues threatens to disrupt both economies because the manufacturing sectors in Mexico and the United States are tightly intertwined. About two-thirds of trade between the countries is between factories owned by the same company, according to Deutsche Bank.