I feel there are many middle schoolers that are honest and reliable enough to leave the school at lunch. My school was next to lots of fast food chains. Also I know that schools can keep track of students via phone. They could track each kids and have them be together in partners or groups where at least one person has a phone for every two people that do not.
Middle schoolers should not be able to leave during luch because most middle schoolers don't even have a car, needless to say money, or enough time to get back to class IF they even come back to the school which im saying they will take advantage of this situation;come back late or not at all. Some neighborhoods aren't safe enough for kids, or rushing to the closet fast food restaurant in a car which could cause accidents and many more terrible situations, and some kids are just to young and immature to be able to leave at all, that's why I think they cannot allow middle schoolers to leave the school grounds for lunch.
Sure, you can ask your parents for money via allowance but you can't get a job until about 14, and lunch costs about $5-10. And I bet most parents won't let you. So its just better to stay with the radius your school holds and play it safe from there.
Middle school children are still very young, impulsive and vulnerable. It would not be safe for them to leave school unsupervised in the middle of the day for lunch. They could fall prey to adults who are predators, or their own impulses could land the, in trouble. They need to remain I. School where they are supervised and safe until they are collected by parents.
Middle schoolers are first of all unable to drive, so they would have to leave school and return on foot/bike, which is time-consuming. Second, high schoolers are considered "more reliable", as middle schoolers would probably leave the school for the day. It seems like it would be too much managing, and you would have to keep track of the middle schoolers much more than responsible high schoolers.