But that is caused by existing economic inequality, not the free market itself. If the rest of your society is organized in ways that e.g. prevent massive unlimited accumulation of wealth, the disparity between what people can afford is much smaller - and then the market can easily be more optimal than any centralized scheme.
Indeed, one could argue that capitalism (which explicitly allows for unlimited accumulation of capital) is detrimental to genuinely free markets for this exact reason: https://en.wikipedia.org/wiki/Free-market%20anti-capitalism