as an employer, i dont care how or where employees prepare their food.
Actually, as someone who has employed hundreds of employees, I can say that there ARE legitimate business reasons why one might do this.
1. An employee approached you and stated that they have severe peanut allergies. They are so sensitive that even being exposed to peanuts inadvertently could be deadly. You have a sign up that says "please do not bring in foods with peanuts to share, yet someone brought in peanut butter cookies even with that sign up. To prevent the risk to the employee, you simply do not allow anyone to bring in food to share.
2. An employee is regularly bringing in food that is unhealthy and contaminated, even after being asked to be more careful. That employee happens to be a minority. If you prevent that person from bringing in food but allow others, you could face a massive lawsuit. It's easier to simply ban any food being brought it.
There are others, but that should be enough.
Now, I don't say that those situations are common, nor would I say that there isn't another way to handle them. But it certainly DOES give examples of why this might be a legitimate business interest.
And, more importantly, the question has already been answered. EVEN IF it were a foolish thing for the employer to do, they are well within their legal rights to do it.