The federal government has some $51.4 billion in its coffers, primarily set aside for road construction and repair. These funds are raised from a federally imposed 18.4 cent tax on every gallon of gas purchased on American soil. On top of the federal tax, each state collects its own tax on every gallon of gas sold.

Just as the cost of gasoline varies considerably from state to state, so does the effective tax rate. 24/7 Wall St. reviewed the amount each state levies per gallon of fuel to identify the states with the highest and lowest gas tax.

Just like federal taxes on gasoline, state-imposed gas taxes are primarily used for road repair and new road construction. In an interview with 24/7 Wall St., Scott Drenkard, director of state projects at the Tax Foundation, explained that gas taxes are designed to function as a sort of user fee. “It’s similar to a user fee in that it connects the users of roads with the costs of their provision and maintenance,” Drenkard said. Indeed, individuals who drive more will contribute to more wear and tear on road surfaces — but they will also end up funding more road repair through the tax they pay on their fuel consumption.

Despite the tax structure’s logical design, gas taxes are not enough to cover the cost of road construction and maintenance. According to Drenkard, gas taxes are particularly unpopular, and as a result, “they are not really high enough to pay for all state and local spending.” User fees, such as gas taxes and tolls, cover only 52.5% of state and local road spending, according to Drenkard.

With such considerable funding shortfalls, it is likely no coincidence that a large share of the nation’s roads are in mediocre or poor condition. According to a report released by the American Society of Civil Engineers, some 32% of major U.S. roadways are in sub-optimal condition. In some parts of the country, the problem is far more pronounced. In 23 states, over half of all roads are in need of some repair.

Partially because gas taxes can be so politically unpopular, some states have not increased per-gallon taxes in decades. Even the federally imposed 18.4 cent gas tax has remained the same since 1993. This pattern is not universal, however. South Carolina, a state with exceptionally low gas taxes, is one of more than a dozen states that may soon initiate modest increases. In addition, seven states, including Pennsylvania, the state with the highest per gallon gas tax, increased tax rates on January 1, 2017.

The amount a state chooses to tax per gallon of gas is only one factor contributing to prices at the pump. The most significant contributor to the cost of gasoline across the country is the price of crude oil, which is largely dictated by global supply and demand. Refining costs also comprise a considerable share of the final price of fuel.

The differences in gas prices between states are largely determined by both taxes and fuel transportation costs related to the distance from supply sources, such as refineries and pipelines. In general, gas prices tend to be higher in states with higher taxes. Depending on the state, gas taxes, including the 18.4 cent federal tax, account for anywhere between 11.0% and 29.5% of the total per gallon cost. As of mid-January, the average price of gasoline ranged from $2.07 a gallon in South Carolina to over $3.00 a gallon in Hawaii.

To identify the states with the highest and lowest gas taxes, 24/7 Wall St. reviewed state and average local gas taxes from the American Petroleum Institute. Average gas prices as of January 24, 2017 for each state came from AAA’s Daily Fuel Gauge Report. We also reviewed average annual vehicle miles travelled in each state from the Federal Highway Administration. The share of roads in poor or mediocre condition came from the American Society of Civil Engineer’s Report Card For America’s Infrastructure, which used data from the Federal Highway Administration. All data are as of the most recent period available.