I think that corporal punishment likely fuels a lot of that 'motivation' to sit quietly without anything to do... from what I have studied/read about child brain development, this isn't necessarily typical behavior at such a young age.
(Not that I'm saying 'let your kids run amok', either)...
Some practical things I've found which work for us (Because I'm not a big fan of corporal punishment):
We have taught our son that going out for meals is a treat, not a right. So when he's misbehaved in the past, we've given one warning, and then we either go take a time out in the car OR take the food home and leave. It's a very effective teaching method, leaving immediately.
We discuss expectations before going into the eatery/establishment, just as we do for all our outings. Our child is five and needs some predictability... thus, telling him exactly what's going to happen helps everyone involved.
I personally see no serious need to make kids just 'sit and listen'. As a preschool teacher, I try to avoid too-long chunks of this, because the kids do get bored and then try to entertain themselves, often in less-desirable ways. Usually, by providing a workbook or paper and crayons, this is a nice balance: we offer something to do which is appropriate to where we are and include him in our conversations, when reasonable. We don't offer things which seem unsuitable to dining out together (iPhones, cars, video games, etc.)
We might also go for a walk/to the park before going to a restaurant so a little someone can get some of that great kid-energy out of his body before we go in. It's a nice family weekend tradition because really, the park is something for kiddo while the restaurant is something for us.
I do not think that, at age 5, there's much moral development to be gained by being able to sit quietly and not utter a peep. I was one of those kids (seen but not heard in public) growing up and deeply feared my parents. In reality, WHO wants to go be among other people without the ability to talk or participate in any way? Why do we have these cockamamie double standards for kids and adults anyway? We certainly don't let him dominate or interrupt the conversations and we don't have a rough time with this. Ultimately, when my son is older, I want him to feel that I was a good guide and helper (and that includes discipline) for him to learn how to be in the world. In my opinion, teaching him how to participate in conversations, how to politely tell a server what he wants, and how to converse with adults is a good thing.