Throughout the presidential campaign, trade with China and Mexico has become one of the most contentious issues. Hillary Clinton and, to a much greater degree, Donald Trump have railed against unfair trade deals that have allowed huge numbers of American jobs to flow to these low-wage countries. Both oppose President Obama’s proposed deal to expand trade with Asia, Clinton wants to revisit the terms of the NAFTA agreement that deepened trade with Mexico, and Trump wants to tear it up.

But as new data highlight this week, these two countries aren’t alone in having an advantageous trading relationship with the United States and the rest of the world. The Munich-based Ifo economic institute predicted this week that Germany’s current account surplus — basically how much goods and services it exports, less how much it imports — will hit an all-time high of $310 billion in 2016. China's surplus, on the other hand, is projected to shrink by $70 billion to some $260 billion this year due to weaker exports.

In this way, the country that has gained the biggest advantage in dollar terms from world trade is not China, nor any other emerging market. It’s Germany. And the reasons offer some insights into why the trade criticism in the U.S. is sometimes too simplistic — but other times spot on.

At a campaign rally in Pennsylvania, Donald Trump outlines seven steps he would pursue as president "to bring back our jobs" (Reuters)

It’s often thought that a trade surplus supposedly is connected to cheap labor and thus outsourcing from richer countries. This is certainly the case made by Trump, who says free trade has damaged the U.S. economy. The U.S. does have the world’s biggest trade deficit, importing $484 billion more in 2015 than it exported. Countries like Mexico or China are, according to this logic, stealing American jobs by offering low wages and other government policies that give an unfair advantage to local companies, such as artificially cheap currencies that make selling abroad more competitive.

Then how come Germany, a country that has one of the highest average incomes in the world, also has such an edge in global trade? Indeed, Germany had a surplus with the U.S. in goods alone of about $74.8 billion last year. It overtook Mexico in 2012 in terms of a lopsided trade balance and is now the country with the second largest trade surplus with America, second only to China. The U.S. replaced France last year as Germany’s most important trading partner.

While much of China’s surplus is caused by cheap labor (although this is beginning to change with the country’s rising wages), Germany has pursued a different strategy.

The country prides itself of its high quality products and their competitiveness. German cars, machines or chemical products are cutting edge in many sectors, and companies have been skilled in producing exactly what industrializing countries like China or Brazil were demanding — such as high-speed trains and advanced factory equipment. As a result, even though the world economy has been struggling in recent years, Germany’s exports have grown constantly. A strong economic backbone of medium-sized but leading companies has also contributed to this competitive advantage, as well as a well organized vocational training system.

And of course, companies have not been shy about marketing their reputation for technical excellence, as you can see in this Volkswagen advertisement:

Likewise, when Germany’s trade surplus has been criticized, German officials have tended to say to other countries: If you have a problem with our surplus, then just improve your products! How can you blame us for being great inventors?

But the thing is the German “great product”-story is only half of the truth.

Although many BMWs or Siemens machines are marvelous examples of technology, their prices are artificially low. Germany has profited from a cheap euro for years (while less competitive euro-zone nations suffered). Because Germany shares the euro with poorer, less competitive countries like Portugal and Greece, its currency is cheaper than it would otherwise be.

This puts German companies in an advantageous position on the world market, because buying from them is cheaper. Some economists predict that a return to the old national currency Deutsche Mark would mean an increase in valuation of about 20 percent.

In addition, Germany on average has lower wages than Belgium or Ireland, though one could hardly argue that their economies have been as productive in the past years. The relatively small incomes of German workers contribute to the trade surplus, because they have relatively little to spend on imports.

“Since the world economy is in a difficult state, the low domestic demand is one of the most important reasons for the current excess,” says Ifo economist Timo Wollmershäuser.

In Europe, Germany has faced criticism for the imbalance for years. Mario Draghi, president of the European Central Bank, has partly blamed the surplus for forcing the ECB to stimulate demand through low interest rates, since the country is not spending enough on its own.

Most economists agree that a long lasting large surplus is not healthy for a country. Under that thinking, Germany might be better off creating new roads, universities and higher-paid jobs than living under its potential to save money.

Yet this message does not resonate broadly. In fact, German citizens and companies, famous for their frugality, share an obsession with saving money. And even the government now has gotten in on the action. After years of deficits, the German government has had a budget surplus since two years ago.

German Finance Minister Wolfgang Schäuble is famous for his love of the “schwarze Null” (black zero — similar to the American expression “in the black”). There have been some policies (minimum wage, lower taxes) to stimulate domestic spending recently, but they were applied in small doses. Even the refugee crisis wasn’t able to get the German government to spend that much more.

The irony to all this is Germany isn’t even profiting that much from its record surpluses. All the money flowing in from abroad has to go somewhere, but solid investment options are scarce at the moment. In the past, the nation’s banks invested heavily in American subprime-loans or Greek bonds for example. We know how that played out.

“Like squirrels, we’re fiercely collecting nuts — but won’t find them in winter,” German economist Daniel Stelter recently wrote in a column.