A few months ago, some ethanol traders in Brazil thought they had a slam-dunk idea—import cheap supplies from the U.S. at a time when domestic prices were surging and stockpiles were shrinking. It didn’t work.

Instead of pocketing easy profits, they ended up flooding the local market. In a surprising twist for a country that is a net exporter—it produces more ethanol than anyone except the U.S.—Brazil’s imports surged eightfold in the four months through February, compared with the same period a year earlier, according to the latest government data. Prices plunged more than 20 percent.

Caught in the squeeze were some big traders and distributors, including Raizen SA, a joint venture of Royal Dutch Shell Plc and Cosan SA; Copersucar SA, which controls U.S. biofuel marketer Eco-Energy LLC; and Biosev SA, a unit of trader Louis Dreyfus Co., according to data from state oil agency ANP. The glut was so bad that the industry called on the government to restore import taxes.

“Some buyers had to wash out import contracts to avoid further losses,” said Tarcilo Rodrigues, a director at ethanol trading Bioagencia, a broker based in Sao Paulo.

Sugar Refining

For decades, Brazil has been making fuel out of sugar to ease its dependence of foreign oil because the country is the world’s largest grower, using about half the crop to make sweetener and the rest for ethanol. The government was so successful in pushing the conversion to a renewable fuel that almost every car in South America’s largest economy now runs on some form of crop-based ethanol.

While there’s usually enough home-grown supply, a jump in prices in 2015 and 2016 made it more appealing to import cheaper U.S. ethanol made from corn. The potential for profit intensified at the end of last year, when consumption was eroding inventories and the cane harvest had yet to start.

Back in November, imports looked like a no-brainer, especially after a decline in Brazilian output last year had left inventories lower than normal. Brazil also had eliminated a 20 percent import tax on ethanol in 2010, a move that was supported by cane millers at the time because they wanted to expand sales abroad by encouraging the U.S. to end its own tariff on imported ethanol.

U.S. supplies in the Gulf of Mexico fetched about 1.38 reais (44 cents) a liter, according to Bloomberg Energy estimates. At the time, Brazilian prices already were around 2.10 reais and forecast to rise further during the first quarter. In the previous five years, prices had reached their seasonal peak in February, March or April.

Domestic ethanol output in the year through March fell 8 percent because mills were diverting more of their cane crop to make raw sugar, after tight global supplies sent the price of the sweetener in reais to an all-time-high. For the season that began this month, output probably will drop 1.2 percent to 25.3 billion liters, according to Datagro, an industry consultant.

Import Surge

As the outlook for supply dimmed, imports from the U.S. surged. In the 11 months through February, purchases from all foreign sources reached 1.11 billion liters, or more than twice the total for the entire previous year, government data show. In February alone, imports reached 259 million liters, a record for the month and the highest since 2011.

Much of the buying began in November, and about 60 percent was by trading companies and fuel distributors, according to Antonio de Padua Rodrigues, the technical director at Brazil’s sugarcane industry association, known as Unica.

Prices remained high in December and through the first week of January, touching 2.079 reais, but then the market tumbled as new supplies arrived, according to data compiled by the University of Sao Paulo’s Cepea research arm. Ethanol slid to 1.591 reais last week, the lowest since May. The 18 percent decline in the first quarter was the steepest for that period since 2010, the data show.

Imports probably didn’t impact prices as much as the end of a tax exemption on domestic supplies, which led to a surge in sales before the new levy went into effect, Paulo Roberto de Souza, the CEO of Copersucar, said in an interview.

The prospect of a tax of 0.12 real per liter starting Jan. 1 “triggered most millers to sell until December a huge volume of ethanol for delivery through the first quarter,” de Souza said, adding that the price slump reduced the company’s expected margins on bio-fuel imports.

Spokesmen for Raizen and Biosev declined requests for comment on their ethanol trading or the market decline.

Slowing demand also cut the rally short. Most cars in Brazil can run on either gasoline or ethanol, and drivers typically fill their tanks with whichever fuel offers the best value at the pump. So, when Petrobras SA, the state-run oil company, cut gasoline prices, ethanol consumption slowed.

“Everybody wanted to make money from ethanol imports,” Unica’s Padua said. “Now, prices have collapsed, and millers are losing money.”