An import tax works just like any other tax. You decide a law that "import of fresh fruit from Mexico is as of (date) subject to a 10% tax" together with details about exactly what fruit is considered fresh, how to calculate the tax, and where to pay.
Punishing their own nationals is very explicitly how this is sold to the voter base. "Prices are going to go up for you but unfortunately we have to do this to try to stop our neighbor from raising their import tax explicitly on goods from us".
Taxes are not a problem if everyone plays by the same rules. The problem for the economy is that some imports are subject to tax and others aren't, or when domestic goods aren't subject to the same tax. Picking winners and losers in an economy by political has never before in history turned out a winning concept.
Punishing their own nationals is very explicitly how this is sold to the voter base. "Prices are going to go up for you but unfortunately we have to do this to try to stop our neighbor from raising their import tax explicitly on goods from us".
Taxes are not a problem if everyone plays by the same rules. The problem for the economy is that some imports are subject to tax and others aren't, or when domestic goods aren't subject to the same tax. Picking winners and losers in an economy by political has never before in history turned out a winning concept.