A big problem is that it often isn't a free market. Joe The Sandwich Guy can't just randomly decide to open up a store inside the airport. There's a limited amount of space, a lease can easily last a decade, and any that come up are usually granted rather than auctioned.
The airport is actively trying to provide a varied selection of products, which inherently means competition is limited: someone complaining about the price of a turkey sandwich isn't going to get a Big Mac solely because it is a few dollars cheaper.
All of this is often made even worse because they aren't actually different vendors. Multiple stores are often owned by the same vendor, the different stores are just "exploiting various retail strategies".
Nothing is actively illegal. Everyone just independently realized they could make a shitton of money because travelers are forced to either pay their prices or starve.