It’s called gouging. It’s illegal.
Its not illegal in most jurisdictions. It ensures availability, seller making available to whom its worth the most to.
What yall miss is anti-gouging laws ensure goods are sold out, hoarded among people who bought excess just because and have no incentive to sell to those in need & willing to pay a high price to it.
Ive faced gas shortages, fuel sold out because everyone topped off just because at controlled prices, when I needed it and was willing to pay 10x for because reasons - but there was none at any price, because anti-gouging laws.