No, it is not illegal. Employers have enormous latitude to set terms and conditions of employment, and requiring employees to purchase items from their employer, or barring them from bringing in outside food or drinkk, is legal. Certainly, if this policy caused an injury to an employee--e.g. dehydration; or a diabetic's blood sugar getting out of range--there could possibly be civil liabiity for it, as there could potentially be for any work policy that results in injury. However, in the absence of something giving rise to liability, there is nothing illegal about an employee barring employees from bringing outside food or drink with them to work or the workplace. There are many workplace policies, unfortunately, which may be "wrong" in many ways but which are nonetheless permitted or legal.