Well, the flags with heavy balls tend to do this more then those without heavy balls.
Persdonally, I use the former.
I have found if you wrap a rubber band or 2 around the base of the flag that the rubber from the rubber band rather 'sticks' (or certainly has more friction than the flag itself) to not only your stripe shirt, but also the elastic on your pants waist.
Also wearing it out towards the hip, v near your belt buckle, helps too.
The same is true for your little black book thingie in your shirt pocket. If you put a rubber band around it, it won't come flying out of your pocket.
Another option I've seen is to tuck your flag in, per the norm; but then pull it out a bit & put that what you just pulled out between your belt & your pants. - so your ball is actually hanging down, vs up like otherwise.