The trade war between the United States and China may have only just started but Tesla and BMW have already figured out ways to limit the financial burden of new tariffs.

Just this week, BMW confirmed that it will become the first foreign manufacturer to own a majority control of a Chinese automobile venture when it reorganizes its ownership structure with Brilliance China Automotive Holdings. Additionally, Tesla announced a Chinese Gigafactory which will be capable of building 500,000 vehicles annually.

Despite the trade war, China has been eager to open up its economy by relaxing regulations to encourage foreign investments, Bloomberg reports.

Tesla and BMW were at risk of being hit hardest by the retaliatory tariffs implemented by the Chinese government on U.S. imports because they both produce hundreds of thousands of vehicles in the United States. By upping their investments in China and building more vehicles for the local market, they can avoid these tariffs.

For many years, China has only allowed foreign car manufacturers to build vehicles on its soil if they form a 50-50 joint venture with a local automaker. From 2022, this joint venture rule will be scrapped by the Chinese government.

The venture’s facilities are responsible for producing current models like the BMW 1-Series, BMW 2-Series Active Tourer and select versions of the BMW 5-Series.

Meanwhile, Tesla’s huge investments in China will allow it to drastically reduce the prices of vehicles it sells in China. As it stands, Tesla products built in the U.S. and exported to China sell for up to 70 per cent more than they do stateside. In response to last week’s tariffs, Tesla raised the prices of Model S and Model X versions by in excess of $20,000.