Yes a gas station can charge whatever they want to charge for a gallon of gas at their gas station.
Some gas stations may price gouge but if it's a smaller gas station then they may have to charge that higher price for a gallon of gas to make a profit.
Most gas stations barely make a profit off of selling gas so if they are not a chain gas station that sells a certain brand of gas then they can charge whatever they want for gas.
However most gas stations especially nearby other gas stations will not usually charge much more than the other gas stations.
When one gas station lowers it's price the other gas station usually lowers the price of their gas as well if they are able too.
Some people don't really care about the price difference though and would gladly pay another 50 cents or so for a gallon of gasoline if that's the only gas station nearby and they need gasoline at the time.