Texas-based refinery giant Valero Energy is the largest publicly traded corporate supporter of Texas Republican Sen. Ted Cruz’s re-election bid. Valero and its senior executives have poured at least $116,500 into Cruz’s campaign coffers this cycle.

Cruz lobbied the Environmental Protection Agency to shift some of its policies — pressure that has led to hundreds of millions of dollars in savings for Valero.

Now, the company’s political investment in Cruz appears be paying off. Over the the last year, Cruz lobbied the Environmental Protection Agency to shift some of its policies — pressure that has led to hundreds of millions of dollars in savings for Valero.

The fortuitous turn for Valero involves an EPA program created in 2005 that mandates the production of biofuels. In order to track compliance with the Renewable Fuel Standard, each batch of ethanol or biodiesel is labeled through what are known as “Renewable Identification Numbers,” or RINs. In order to comply with the mandate, companies may blend biofuels or purchase RINs on the marketplace. But the increasing compliance costs have angered the traditional oil industry, which has complained that the original policy is outdated and overly burdensome.

Valero is among the oil refinery firms that lack adequate facilities to blend biofuels, forcing the company to purchase RINs from the marketplace, thus making it more reliant than others on the market price of the tax credit.

Cruz, in turn, repeatedly lobbied the EPA to lower the cost of RINs. Last December, the senator asked the EPA to cap the biofuel credits at 10 cents, well below the market rate of 70 cents per RIN credit last year. He also met personally with President Donald Trump over the issue. The administration has awarded exemptions to the renewable fuel mandate, and allowed RINs to be awarded to fuel exports. The sustained advocacy against the program has spooked investors, driving down the price of the credits.

There are winners and losers with lower RIN prices: Gas stations, ethanol producers, and oil refineries that have invested in biofuel production may lose out. Critics of the program argue that ethanol is not the most efficient renewable energy and that farmland should be primarily used for food production, not fuel. But the biggest winners of crashing RIN prices are overwhelmingly oil companies, and Valero — amid major donations to Cruz’s campaign — is reaping a financial windfall. Neither Valero nor Cruz’s office responded to a request for comment.

In recent statements to investors, Valero Energy projected that the plummeting costs of RIN renewable energy credits saved the firm $124 million in this year’s second quarter. The company projects continued savings from the falling price of the energy credits, which have cost the firm as much as $750 million annually in previous years.

Valero Energy poured resources into helping elect Cruz. In July, the company gave $100,000 to Texans Are, the pro-Cruz Super PAC that is now battering his Democratic opponent, state Rep. Beto O’Rourke, D-El Paso. The company has also donated another $4,000 to the Cruz campaign through its political action committee, and executives at the firm have donated as individuals.

Valero’s lobbying team in Washington, D.C., has long focused on the Renewable Fuel Standard, which established RINs. Disclosures show that all 18 registered lobbyists for the company listed the policy as an issue they are currently working to influence.

The policy fight over the renewable energy fuel standard, which was designed to promote the ethanol industry, has long pitted politicians from corn-producing states, such as Iowa and Nebraska, against those from oil-refining states, such as Texas and Louisiana.