There is no simple answer to this question. It’s not just supply and demand but also the cost of bringing the product to market. The difference between the selling price and the cost to bring the product to market is where the profit or loss is.
With gasoline, it is a loss, not a profit. Why do oil companies sell gas at a loss you might wonder. A barrel of oil sells for a $100 +/-. Thats 42 gallons of which only about 20 gallons becomes gasoline or other volatile products. The rest becomes plastics, cosmetics, medicines and other high value products which are worth about $2400 on the market. To make money on the other products, they are motivated to process a lot of oil.
Gasoline and the other volatiles are actually hazardous waste, but a useful hazardous waste. Lucky for the oil companies. Now the trick is to sell the hazardous waste at the lowest loss. Taxes are just a part of the cost to bring the product to market and not a major determination in the final price. It is treated as the same as all the other factors.
The oil companies have big computers that take in all these factors and develop curves for the price/sales volume and cost/units delivered. When they overlay these curves, they find the point of most profit, or least loss.
In the end, the cost of the raw materials and the taxes are just factors, the supply and demand for all the other products also factor in and when all the curves for all the products are compared, the oil companies determine the most profitable amount of oil to process each day and the best price (for them) to charge at the pump.
In the end, the tax on gas really has little affect on the final price, but it does have an affect. Its just not linear.
I’ve read “The Wealth of Nations”. Everything else I know about business, I learned from a Waitress. That business degree was a waste of time except to look good on the resume.