Free market capitalism works really efficiently, except when externalities are present, at which point it efficiently exploits them to everyone's detriment. Your health is an externality to the corporations that make your food.
Food companies spend a significant amount on R&D to maximize the taste and attractiveness, but not necessarily the nutrition, of their pre-packaged foods.