Looking at this link, it appears that most locales apparently charge both a flat per gallon tax and also collect some tax at a (low) percentage rate. That flat portion would represent a smaller percentage of the price if gasoline goes up and a larger percentage if gasoline goes down.
So your observation that the absolute amount collected does indeed go up in most locales since they have some tax that does float with the price, and the relative amount also tends to go down since a portion of the tax is based on a flat tax per gallon.
As a concrete example, let's say that state A is charging a flat 25 cents per gallon, and also levies a 6% sales tax on gasoline sales. Then if the pump price before sales tax is $2.00, and the final price with sales tax is $2.12, taxes are 37 cents per gallon (12 cents for sales tax, 25 for the per gallon gas gax.) Then tax represents 17.45% of the price.
Now let's say that gas goes to a pump price of $3.00 per gallon before taxes. Now the final price is $3.18; the tax portion would 18 cents for sales tax, and still 25 for the per gallon tax. That makes for 43 cents in taxes, which is indeed more than the 37 cents when gas is selling for $2.00, but the percentage has now droppoed to 13.5%.
Note that on a state sales tax such as this they are actually taxing taxes, which escalates as the price goes up. It's no secret gubmit likes high gas prices, it keeps them in business.