That's a hard age because it seems like they're old enough to be rational, but they really aren't. I think you just keep checking his pockets (if you want to try not to single him out you could even do a pocket check on everyone when you leave somewhere) and you can decide how you feel about having him bring it back to the person and confessing to stealing it and apologizing (I once had ds take a library book he had ripped on purpose back to the librarian and tell him what he did. He was shy and I ended up telling her but he was right there with me. He never, ever destroyed another library book after that, even though we were kind and gentle about it- both I and the librarian. So sometimes having to admit it to someone or even stand there while your mom admits it can be helpful- it's also the right thing to do to admit mistakes). It would be easy to pull the "how would you like it if someone took something of yours?" but a kid that young will know they wouldn't like that but can't understand how that as anything to do with what he is doing. I would be really careful not to label him a thief, though.
It's hard to have kids do impulsive things, but try not to project this on his whole life- like don't think about what's going to happen in 20 years if he keeps this up- just focus on the here and now. He's little. He's impulsive. Eventually it should click for him.