When an imported good enters a port in the United States, the importer of record initially gets the bill for the tariff.

So tariffs are a tax on middlemen?

Not usually. This is where the question of who pays tariffs gets trickier — because middlemen tend to pass on their costs.

A company that contracts with an importer will almost always see the costs of that contract rise after a tariff has been imposed on goods it imports. So now the company is paying, say, 10 or 25 percent more to bring in the exact same product it imported before the tariffs. The company faces a choice: What should it do about those extra costs?

So tariff costs get passed to an American company. What are its options?

The company could pass on the added costs to consumers, in the form of higher prices. That’s the simplest route, particularly in a competitive market where the supply chain is not easily moved. (Washing machines are a good example of this. Their prices rose in the United States earlier this year after Mr. Trump’s administration imposed tariffs on them.)

Companies can also try to minimize tariffs by switching suppliers or changing the products they sell. In the case of China tariffs, that could mean moving a factory from Beijing to Vietnam. In this case, no one pays the tariffs; the company is making an end-run around them. Alternatively, an American company could negotiate concessions from a Chinese supplier, likely by threatening to shift production. In that case, the Chinese supplier’s profits would fall, and it would bear at least some of the cost of the tariffs. Some research suggests American companies have had success essentially passing the bill back to China.

Some companies may choose to absorb the extra costs themselves, by accepting lower profits. They choose neither to raise prices nor immediately pay to shift production, based on the idea that the most economically efficient price to charge for the product is not changed by the existence of tariffs. That could be the case with Apple: It can charge such a premium for iPhones that it might decide to accept smaller profit margins on them for a while, if they become subject to tariffs.

How does China end up paying?

It never does, directly. But there are certainly ways that American tariffs hurt China. If companies move production to Vietnam, China would see less economic growth — though that itself is not a direct benefit for American production, and in the short term would be a headache for companies that have to find new factories.