How about this - Iran imports gasoline and subsidizes the dirt cheap (or lower) gas prices for the people. Apparently, it is cheaper than building refineries.
I am sure the Venezuelan gas is also subsidized for political reasons.
Much of the cost of refined petroleum is in the construction and operation of the refineries. The distribution, storage, inventory and marketing of the fuel is also on top of that.
The cost of the crude is to a great extent due to the speculators that maintain a market and market price that is affected by what the fuel demands will be and where they will be. Most refiners buy crude futures through a speculator system because there is so much joint ownership of wells, refineries, pipelines and retail operations. The retail price is defendant on the refinery price and the local demands and inventories. - In other world it is a "can of worms" and then the individual federal and state governments add the taxes on top.