As Los Angeles drivers shelled out more than $4 a gallon at the pump in recent weeks, the state's oil refineries pocketed record amounts of money — as much as $1.17 a gallon in gross profits.

From Jan. 1 to July 6, oil refineries almost doubled the typical amount they collect on a gallon of gasoline, state data show.

California refineries reaped an average of 49.3 cents on a gallon of gasoline from 1999 to 2014, according to the California Energy Commission. But this year, the average ballooned to 88.8 cents, triggered when refinery troubles in February disabled 7% of the state's capacity at a time of low inventories.

With oil prices falling, refinery costs stable and gasoline prices soaring in California, refineries are experiencing a boom in profits.

"Is it unusual? Absolutely," said Gordon Schremp, a senior fuels specialist at the California Energy Commission. "They are making more money. And yeah, consumers are, unfortunately, having to pay significantly more."

A lucrative business in California

In May alone, the state's fuel-making companies took in a record high of $1.17 a gallon at the refinery level, according to an analysis of the commission's data by the advocacy group Consumer Watchdog, set to be released Wednesday.

The commission's gross profit statistics for refineries, called "refiner margin," represent a mixture of costs and profits at the state's 11 fuel-producing plants. Because refiners don't reveal their costs or earnings in the state, the energy commission approximates local profits by subtracting the cost of oil as well as taxes, distribution and marketing from the retail price of gasoline.

Is it unusual? Absolutely. They are making more money. And yeah, consumers are, unfortunately, having to pay significantly more.— Gordon Schremp, a senior fuels specialist at the California Energy Commission

On July 6, for example, the state's average retail price for name-brand gasoline was $3.432 a gallon, according to a weekly survey by the U.S. Department of Energy. Of that, $1.36 represented the cost of crude oil; 32.6 cents was attributed to distribution and marketing costs; 58 cents went to taxes and fees — leaving $1.166 in refiner gross profits.

The refiner margin doesn't represent a net income figure reaped by the refiners, but it indicates the rise and fall of those firms' profits.

And the profit increase has left motorists unhappy.

At a Shell gas station in Boyle Heights, where a gallon of regular gas was $4.77 with cash payment, Natalia Montes said she has little choice but to pay the higher gas prices.

"I don't know why it's so expensive if they're making a profit," said Montes, 19. "I can't go out every weekend because I feel like I'm wasting gas," she said.

Jamie Court, president of Consumer Watchdog, called on lawmakers and Gov. Jerry Brown to "deter this type of gouging by establishing a windfall profits tax and forcing refiners to open their books and justify their inventories, refinery outages and profits."

Four oil refiners control 78% of the state's gasoline-making capacity, Consumer Watchdog said in its report. "The consolidation has led to a lack of competition, and unwillingness to undercut competitors' prices, despite record profits per gallon," the report said.

But Tupper Hull, a spokesman for the Western States Petroleum Assn., which represents oil producers and refiners, argues that Consumer Watchdog's view and the energy commission's refiner margin calculations are overly simplistic.

Hull said the market is responding to the basic laws of supply and demand after the refinery troubles and a drop in gasoline inventories.

"The function of supply and demand work very efficiently to make sure that there's fuel at that pump," Hull said.

He said that might mean that prices rise for a period of time because of the decline in refinery capacity from plants that aren't producing gasoline and from a shortage in inventories, but it will balance out in the long run.

Consumers, Hull said, would be harmed if oil refiners operated with complete transparency because such openness would enable the kind of industry collusion that companies are accused of now.

This year's record refiner margin through the end of June topped the previous record set in the first six months of 2007. The refineries' average take during that period was 85.9 cents a gallon, about 3 cents less than this year.

Then, as now, oil companies attributed at least part of the price increase to problems at California refineries.

This time, the primary catalyst was a February explosion that crippled Exxon Mobil's Torrance plant, which has historically produced about a fifth of Southern California's gasoline. It might not return to service before Christmas

"As long as Exxon Mobil is offline, the whole market is going to be at an elevated price point," Schremp said.

That means Exxon Mobil isn't benefiting from the high gas prices, though others such as Valero and Shell are raking in significant amounts of money.

"That's their reward, and that's their motivation to have no problems," Schremp said.

California prices are almost always higher than national prices. The AAA notes that prices are driven up by higher-than-average taxes and fees, state requirements to produce special low-pollution blends and the relatively small number of refineries in the state.

Part of that cost includes an estimated 10 to 12 cents a gallon for the state's cap-and-trade market that was instituted to help combat global warming.

From the more affluent to the average Joe, high gas prices are changing behavior.

Norm Woods, 45, of Los Angeles said that although the gas prices haven't hit him hard, the additional cost has forced him to leave his more gas-guzzling Hummer at home in favor of his Acura.

"It's just 'politics' again," Woods lamented. "Every year, they tell you the profit margin is larger and larger."

It's been more difficult for 49-year-old Paul Valles. Valles, filling up his Jeep Commander on Tuesday afternoon at a 76 station near L.A. County-USC Medical Center, estimates that he pays about $30 more for gas than he did a month ago.

The Valencia resident commutes to Los Angeles a few times a week for his medical supply job and said he's shopping for a hybrid to replace his car, which gets about 10 miles per gallon.

"There's not much we can do as individuals or small groups," he said about the refinery profits. "We're held hostage to it."