They date back to the gas station price wars of the 1960’s. Gas stations would literally run themselves out of business trying to undercut each others’ prices, and so various government agencies stepped in to set the minimum pricing to prevent that.
I think the way it usually works is that the minimum price is just based on the last shipment, so when prices are plunging you just have to wait for the next time the delivery tanker comes by instead of actually selling all the expensive gas in your underground tank.