Having free meals on the card also ensures that students have the opportunity to buy food. In the days of EMA (for 16+ kids), before we went cashless, some parents would come in to escort their child to a cashpoint, leaving them without money for food (we fed the child but told them not to say).
There are many options to ensure students don't run out of money, including a weekly direct debit. We allow a small negative balance for children and the manual adjustment by canteen manager for staff (so 10p we would wave unless the person was annoying ... not saying that's why you were asked to find the money).
A card also allows us to flag any medical problems, so a learner buying something with nuts that has an allergy will be flagged, rare as this may be.
It also allows us to monitor learners with eating disorders and report to parents if we get complaints learners are not eating properly. You need to remember breakfast and lunch in school may well be the main (indeed only) meals a child may get for the day, so the ability to check nutrition is important, a day of junk is fine but 2 weeks solid is a sign.
Another reason for not having cash payments is it's cheaper, no need to get security firm in to collect the cash, not to mention the counting to make the tills balance (even after the cut from the card companies). Those without ability to pay online, can have payments made in cash at the school that will top up the system.
Fortunately most children and parents seem to be able to manage having enough money on their cards, even if it was a struggle for you.