I have done over 4000 km in Indian trains over the last six weeks. I have not had one single problem with the food bought from the official IRCTC stands or guys going around. Look out for people with uniform shirts.
Some of the food was actually excellent
Any station