ARGENTINA has never been a simple place for foreign companies to operate in. Inefficiency and inflation have plagued the country for decades. That crises occur every dozen years is accepted as fate. Recently, however, government hostility has made doing business even harder.

Cristina Fernández de Kirchner, the country’s president, has a habit of bashing foreign firms: she has blamed Shell for forcing her to devalue the peso; she has threatened to slap an American printer, RR Donnelley, with terrorism charges; and she has accused American Airlines of being in cahoots with the creditors that led Argentina to default in July. “Vultures with turbines,” she called the airline.

Yet it is a series of tax raids that has foreign firms on edge. In late November Argentina’s tax agency, AFIP, accused HSBC, a bank, of helping over 4,000 Argentines evade taxes. Earlier that month AFIP announced that it had suspended Procter & Gamble’s operations in the country for allegedly overbilling $138m in imported hygienic products to avoid taxes and get dollars out of the country.

P&G since seems to have resumed its business in Argentina. It declined to say whether it had reached a settlement with the AFIP. “Except the agency and the company itself, no one knows what P&G did or didn’t do,” says Santiago Zebel, who heads the tax-law programme at Torcuato di Tella University. “But we do know that AFIP has dual incentives: like all tax agencies, it aims to collect dues, but it also tries to ensure dollars aren’t leaving the country.”

Since 2011 companies have been unable to send their profits freely out of the country. Ms Fernández imposed this clamp, along with draconian currency controls, to stem capital flight. She also restricted imports, requiring firms to export goods equivalent in value to anything they imported. To bring in its cars, for instance, BMW has exported rice.

Ms Fernández’s plan has failed: currency reserves have plummeted to $29 billion, from $52 billion in 2011. But the measures, along with the price distortions created by having multiple exchange rates and inflation running at 40%, have turned Argentina into one of the world’s worst places to operate a company. It ranks 124th in the “business environment” category in the 2014 Global Innovation Index of Cornell University—below countries such as Ukraine and Mali.

In response, some foreign firms have fled the country. According to Desarrollo de Negocios Internacionales, a consultancy, 40 foreign companies have left or frozen their operations since 2011, including Elektra, a Mexican electronics retailer, British Gas and luxury brands such as Calvin Klein and Cartier. Last year Vale, a Brazilian mining giant, pulled out of a $6 billion potash project and has since left the country. In November Carolina Herrera, a clothing brand, announced it would also close its shop due to the difficulty of getting products into the country.

Of the companies that have stuck around, many have scaled back their operations. In August Farm Frites, the world’s second-largest french-fries maker, sold 60% of its Argentine assets. General Motors recently announced it would suspend importing cars into Argentina from Brazil. Foreign direct investment in the first half of this year was minus $55m, compared with $5.9 billion in the same period in 2013.

Some firms have come up with creative ways to cope. American Airlines recently stopped selling tickets in Argentine pesos more than 90 days ahead of a flight—to limit its exposure to inflation or a potential devaluation. A subsidiary of Ford recently bought an olive-oil factory, ostensibly both to grease its import channels and also limit its stock of Argentine currency.

Asked what his firm was doing with excess pesos, an executive of another foreign car firm just laughed. “You think in this environment we’re making much of a profit?” His strategy is simple: “Make it to next year.” This attitude seems common among the firms that have not already left. In October 2015 Argentines will elect Ms Fernández’s successor. All three of the leading candidates are reputed to be more business-friendly than she has been. But until one of them takes office, foreign businesses in Argentina are in for a rough ride.