Washington: When President Donald Trump rages about unfair trading practices, he usually directs his ire at China and Mexico. By comparison, Japan and Germany get off easy.

The focus on China is understandable: The US trade deficit in goods with China ($347 billion (Dh1.2 trillion) last year) is five times bigger than any other.

The US trade gap with Mexico ($63.2 billion), though, is smaller than the ones with Japan ($68.9 billion) and Germany ($64.9 billion).

Still, when it comes to Trump’s rhetoric, “the volume on Mexico is three times as high,” says Gary Hufbauer, senior fellow at the Peterson Institute for International Economics.

Another sign of the difference in relations: Japanese Prime Minister Shinzo Abe is on a friendly trip to the United States, with Trump welcoming him to the White House with a warm embrace. By contrast, Mexican President Enrique Pena Nieto last month acrimoniously cancelled a planned meeting with the new American president.

Why does Mexico bear the brunt of Trump’s wrath, while Germany and Japan usually get a pass?

The politics of immigration

Trade tension with Mexico is easily conflated with anger over illegal Mexican immigration, a hot-button topic with Trump’s core supporters. Many voters believe Mexicans are taking American jobs, both as a result of trade policy and of illegal immigration. In their view, the North American Free Trade Agreement — a US pact with Mexico and Canada — pits US workers against low-wage labour inside Mexico. Mexicans also have crossed the border illegally and taken jobs inside the United States at low pay.

Trump has promised to renegotiate or withdraw from NAFTA and has threatened to tax imports from Mexico. He also has vowed to build a border wall to keep illegal immigrants out of America.

Made in the USA

Three decades ago, Japan figured out how to calm America’s anger over surging Japanese imports: move factories to the United States and hire Americans.

So Honda now builds Accords and Acuras in Ohio, Toyota makes Camrys in Kentucky, Nissan cranks out Pathfinders and other vehicles in Tennessee. The Germans, too, put up American factories. Volkswagen manufactures Passats in Tennessee, BMW makes sedans in South Carolina, and Siemens builds turbines in North Carolina.

Overall, Japan had invested $373 billion in the United States by 2014, Germany $224 billion and Mexico just $18 billion, according to the Organisation for International Investment, a trade group that represents foreign companies in the United States.

The US investment and hiring shields Japan and Germany from criticism.

“As soon as you start wailing on Honda, Toyota or Nissan, you’ll have a governor standing up, saying, ‘Hey, these are great companies,’” Peterson’s Hufbauer says.

Charm offensive

Japan, in particular, seems eager to get on Trump’s good side. The charm offensive started less than a month after the election, when Japanese tech billionaire Masayoshi Son promised to invest $50 billion and create 50,000 jobs in the United States.

The Japanese government’s Facebook page has been featuring posts on Japanese who have contributed to American life — the designer behind the interior of New York subway cars, the paediatric cardiologist caring for Miami babies with heart problems, an oncologist using a new cancer treatment in Houston.

The Japanese are also using golf diplomacy on the links-loving Trump: Abe presented the president with a $4,500 Honma driver when they met last November in New York. In a news conference Friday, Abe flattered Trump by noting that the American president was the superior golfer.

Japan and Germany don’t get off the hook entirely. Trump upset Japan by pulling the United States out of a 12-country trade agreement called the Trans-Pacific Partnership. And he has accused Japan of manipulating its currency to gain a price advantage for its exporters.

Last month, Peter Navarro, the White House’s director of trade and industrial policy, complained to the Financial Times newspaper that Germany was exploiting an undervalued euro to boost its exports.