If someone buys up a lot of the food and medicine and tries to resell it at a high price, people will have to buy it, since unlike for non-essentials, they can't just wait for the market to make more, they need it immediately. But this can be solved easily by the community signing an agreement with the supplier before production.