. . . the million-dollar-question: Why do prices vary between gas stations located near each other? Part of that answer lies in transportation costs, which come into play even when stations sit side by side. Moving crude oil to a refinery, through a pipeline or across an ocean, and on a truck to supply the station adds up. Based on contractual agreements, routes from rig to pump vary considerably, making one station's gasoline more expensive than the other's.
Before the gas station owner puts those giant numbers on the marquee, taxes are added in. The federal government taxes gasoline, and so do state governments. The
EIA reported 18.4 cents per gallon of federal tax and an average of 28.62 cents per gallon of state taxes as of August 2018. Some municipalities add their own taxes on top of these.
Finally, the gas station owner, an individual franchisee or a corporation, sets a price allowing for profit. This final piece incorporates the cost of doing business, as well as the aims of the gas station, such as whether it is mainly a filling or service station, or if the goal is really to make money selling taquitos.