It's also generally more cost effective for the company to buy food in bulk compared to passing the cash onto you in your salary for you to buy food on an individual basis.
Plus (and this is dependent on the company handles the providing free food business), food cooked or prepared on site is potentially healthier and tastier than whatever calorific sandwich and chocolate bar you picked up on the way to work. Healthier and happier employees are a win for both parties.