You're right, oil refineries have been losing money. My sister in law is a chemical engineer in Kentucky. In a nutshell, she explained that oil refineries have been put under such strict regulations by the EPA, that production cost for the refineries is incredibly high. She also states that gas should have been closer to $5 a gallon 2 years ago. BUT, the .gov (which passed all the EPA regulations) hadn't thought all the way through to refinery production cost. Refineries are heavily subsidized by the .gov so that they are able to remain open for business. I know that the media is alway harping on the $70 billion that stateside oil companies receive in .gov subsidies every yaer. But, they don't tell the public that those subsidies keep gas prices down to $2.65/gallon when they should be closer to $6/gallon, like in the UK. The refineries can't keep up with the demand, the .gov can't subsidize them quick enough, prices keep going up.
What are the EPA regulations? for every acre of land that an oil refinery uses as its campus, several hundred acres must be preserved in area around the refinery, also the refinery must maintain the environment of that area. For every gallon of water used by a refinery, 1000 of gallons of water must be inspected by the refinery to ensure that they are not harming, or contaminating the surrounding environment. The EPA regulations were passed as a conservation minded bright idea, with no forethought to the cost. Subsidies paid by the .gov keep consumer cost down.
This whole thing can be related to the .gov laws that limit classroom sizes in schools. Every parent voted for classrooms to not exceed 30 students, which broke up classes, causing a need for more facilities, more teachers, more money. No one thought that far, and no one wants to pay for it.
It's political agenda and nothing else. "Give the people what they want" - so long as they keep voting for me - the rest is just details.