This isn't a terribly surprising thing for a two year old to do. After all, catch games are fun, aren't they? And in the appropriate environment at the appropriate time, there's nothing better to do than simply play along.
However, obviously many times this isn't acceptable. The best way I've found to deal with this was to clearly explain to my son what the appropriate times/places were, and what they weren't; then when he (of course) forgot, to be consistent with appropriate discipline: tell him that he needs to come, now, or we're [going home from the play area|putting him in a shopping cart with a seatbelt|having a time out in the car]. Maybe count 1-2-3 at a reasonable pace. This will be necessary a few times, including leaving places you might prefer not to leave, but by 2 they are capable of understanding reason to some extent. Making sure the punishment is relevant (taking them out of the dangerous situation) and timely (happens right now, not "we will never come here again" which is pointless) is crucial.
I can't under-state the value of explaining the reasoning to them, in addition to the relevant, timely punishment. If you are planning to raise a reasonably independent child, making sure they understand why it is important to not run off is key, because just punishing them without telling them why won't work for many children.
My son just turned three, is one of the wilder children you've ever seen in many situations, yet I feel entirely comfortable going to the museum with him, or walking down a sidewalk on a fairly busy street, without holding his hand except to cross streets, because he learned not only that there were consequences to running off, but why it is dangerous to run off. He knows that staying in sight and within the same area is important, because he could get lost or hurt. We talk about it with him periodically, and have had pretty intelligent and complex conversations with him since he was two or thereabouts - including reinforcing the lessons by asking him why he thinks it's dangerous.
You do still end up sometimes having to play chase, especially in more dangerous situations where it's not okay to give them a bit of time to comply, and having to use those consequences, even after they've learned better, mostly; that's fine. Kids are kids, and sometimes lose control. It should be rare, though, and rare enough that when it does happen it's a noticeable thing for them.
One thing I do not recommend is raising your voice for the purpose of showing anger. Beyond the fact that it's generally not effective, in this particular situation you want to use raising your voice to indicate alarm (ie, concern for immediate safety). If you don't usually yell, but loudly yell their names in situations where they are, for example, about to run into a busy street, it's more effective than if they're used to you raising your voice to call them back, and they've established a pattern of sometimes complying, sometimes not.