Well to be accurate, up until 1824 there was no "US" gallon, the newly formed US of A used the British measurements, ounces, pints, quarts, and gallons.
It was the British that changed to the "Imperial" system in 1824
US gallon(and British prior to 1824) is 128 ounces, 8 US pints, or 4 US quarts, from "old England"
Imperial gallon was changed and so were pints and quarts to a new "standard", Imperial standard.
A pint was now 20 ounces instead of 16, more beer in the glass, lol.
Making an Imperial gallon 160 ounces
US of A didn't change, so our measurement become the "US gallon, pint and quart" by default.
Like OBD became OBD1 when OBD2 was introduced

1 Imperial Ounce is .96 US ounce, so almost the same
And it could have been the cost of switching over to Imperial measurements was the reason the US didn't change, new country, and not a "have to have" expense.
When Metric was introduced as world-wide standard, and fuel is sold by Liters, US also didn't follow suit, but not a cost issue, just stubbornness, lol.