Why would anyone especially a teacher wants not just to isolate a child but stigmatised then for actions by their parents, not the child?
I would not suggest that school meal payment are not necessary, and parents who pay for their children school meals have a responsibility to make those payments or if they are unable to so then they should apply for assistance.
However, none of that gives a teacher any justification in treating pupil with such draconian behaviour. Detention is supposed to be used against a pupil in a positive way and using because their parent is unable to pay dinner money is diabolical.
Children are not responsible for their parents; it is the other way around, and therefore, there is no justification in punishing a child unnecessary and in my opinion, the teacher should not be put anywhere near children. Her behaviour is abominable, to say the least.