I saw a thread about this very same thing some time ago. I decided to experiment a little bit.
Grab the full mag in either hand, bullets facing toward palm. Place thumb on tip of first round and simply push down. No more rattle.
Not sure if it works on the XD mags, but works with my Sig mags.