You are allowed to, you are not a prisoner. Beverages are not free on trains. If you order or take something you have to pay for it, often even if the staff tells you that it's free. If you are on a special diet or on a small budget you can also bring your own food and drinks with you.