As the federal government and myriad charities hunt dollars to help Louisiana with its latest disaster, a Biblical flood, Louisiana is getting ready to help Hollywood with $37.7 million in state aid for a disaster movie, Lionsgate’s Deepwater Horizon.

Such are the breaks of the film incentives game, which sometimes has a way of taking money from those in need, and sending it—at the least opportune moment—to others who need or want it for purposes of their own. Something like that happened in 2008, when Louisiana contributed about $27 million to a Brad Pitt movie, The Curious Case Of Benjamin Button, even as Pitt and his wife, Angelina Jolie, had been raising millions to help rebuild Katrina-ravaged New Orleans through the Make It Right Foundation.

This time around, Deepwater Horizon, backed by Participant Media and Lionsgate’s Summit unit, has been both lucky and unlucky in its timing.

On the lucky side, the movie—set to show at the Toronto Film Festival early next month, before its September 30 opening—was among the last high-budget productions to qualify for incentives before Louisiana, strapped for cash as oil markets and employment declined, tightened its generous movie tax credits program.

Directed by Peter Berg, with Mark Wahlberg in the lead as an oil worker coping with the disastrous Deepwater Horizon well blowout of 2010, the movie was initially certified for the Louisiana incentive on February 19, 2015. Just a few months later, the state would put a $30 million per-project cap on its incentives, among other restrictions. But Deepwater qualified under the old rules, which allowed incentives ranging up to 45% of some budget expenditures, without the cap.

The original certification described an overall budget of $156 million, with a Louisiana “spend” of $118 million. A final certification, issued on June 28, showed that Louisiana expenditures had grown slightly, to $122 million, which entitles the producers to total credits of $37,737,087.10.

If it chooses, the producers can sell those credits back to the state at 85% of their face value, which would yield a cash payment of about $32 million, assuming Louisiana doesn’t exceed a new overall film incentives redemption cap of $180 million a year. In return for the money, Louisiana, according to the movie’s original certification, was to get the benefit of about 2,500 jobs, including 85 welders who helped to build and maintain a replica of the original Deepwater Horizon rig.

(Paramount’s Jack Reacher: Never Go Back and Oprah Winfrey’s Queen Sugar television series have also shot in Louisiana lately under the incentives program.)

Associated Press

But this is not the happiest moment to be taking money out of Louisiana; on Thursday, after all, President Obama was in the state, assessing flood damage and cash needs, and Donald Trump had already shown up to lend a hand.

Last Wednesday, the backers of an online petition asked the makers of Deepwater Horizon to donate a share of the film’s proceeds to nonprofit organizations still working on the oil-spill clean-up, and to show a trailer for The Rising, a documentary about the disaster, with screenings of the movie.

As of late last week, people briefed on the film’s release said Lionsgate and Participant were inclined to do neither; and Participant had yet to work out the dimensions of a social action campaign that is supposed to accompany the movie, as with every Participant project.

If that campaign were to take a stance against fossil fuels or high-risk deepwater drilling, it might put Louisiana and its residents—many of whom were unemployed even before the new flooding—in the position of funding a film that further undercuts a mainstay of its economy, the oil industry.

Far more likely, one suspects, is a campaign that will somehow return something to a state that is still sending money in Hollywood’s direction.