There are a lot of things I love about living in South Carolina. The weather is fantastic, the people are friendly, and our gas prices are the lowest in the nation. In fact, at the moment, the average price of regular gas in South Carolina is just $2.39 per gallon, according to GasBuddy.com. That's not only a few pennies better than our nearest rival, but it's more than a dollar cheaper than California, which has the highest gas prices in the nation. While we like to blame oil companies for the differences, there are actually three distinct reasons why gas prices are so different by state.

Source: EIA. 

1. Taxes
As that diagram on the right shows, the price of gas in the U.S. has four main components. About half the price is derived by the value of crude oil, followed by refining at 22%, taxes at 17%, and distribution and marketing at 10%. Because crude oil is traded on the global marketplace, it doesn't have a lot of impact on the difference between gas prices by state. In fact, top oil-producing states like Texas and North Dakota aren't among the states with the lowest gas prices because crude isn't the biggest driver of state-by-state difference.

Instead, one of the biggest drivers of the gas prices difference between states is taxes. The U.S. average for state gas taxes is currently $0.48 per gallon. However, a number of states have gas taxes well over that average, which pushes gas prices in that state much higher than average. In fact, there's a pretty direct correlation between states with the highest gas taxes also having the highest gas prices and vice versa for those with the lowest taxes and lowest prices. For example, gas taxes in South Carolina are the third lowest at just $0.35 per gallon while those in California are the second highest at $0.66 per gallon, contributing to some of the difference in prices between the two book-end states.

2. Distribution and marketing
Distribution and marketing costs also drive differences in gas prices. These are the costs for getting petroleum products from a refinery to a gas station and into a consumer's car. A factor driving these costs are pipeline tariffs, which are charged by pipeline operators to shippers that move gasoline in pipelines. Much like a toll road, the greater the distance traveled, the more expensive it is to ship the gas. It's one reason why southern states South Carolina, Mississippi, Alabama, Tennessee, and Louisiana have the lowest gas prices in the country as they are closer to America's oil-refining center along the Gulf Coast -- they benefit from lower distribution costs as the gas doesn't have to travel as far. Hawaii, on the other hand, has the second-highest gas price in the country due in part to higher transportation costs as its gasoline needs to be imported by ship, which is much more expensive than gas shipped via pipelines.

3. Refining
A third factor is the actual cost of refining oil into gasoline, which can vary greatly according to a refinery's location. California, for example, is home to some of the stiffest environmental regulations in the country, which are higher than federal regulations and add to the cost of refining gasoline in the state. Furthermore, its refineries are almost always running at full capacity just to meet demand so when one does get shut down, as happened earlier this year, it leads to a spike in the state's gas price.

Meanwhile, states that either have less stringent regulations on their refineries, or import a bulk of their gas from low-cost refining states, tend to have lower gas prices. That's actually another driving force behind lower gas prices in the Southeastern U.S. as Gulf Coast states Texas and Louisiana have low-cost refineries, which is why both are among the top ten states with lowest gas price. Further, both states export their gas to neighboring southern states, including South Carolina, for example, which is when combined with lower taxes is why several states in the south have much lower gas prices than their northern or western peers. 

Takeaway
While gas prices nationally will ebb and flow with the price of oil, there are other factors at play on a regional and state level that have an impact on prices. The real reason why we see such a great difference in gas prices between states is because widely varying taxes, distribution and marketing costs, and refining costs are key ingredients in the makeup of the price of gas in each state.