Now we have to find the source of this electric buildup. Where do you think it's coming from. We can't solve the problem without that information. You can't say it's static electricity without that information either.
Pockets as a whole in sports shorts/pants are usually made up of 3 total layers: pocket inner, pocket outer, and pants. 3 layer is plenty of space to rub and generate static electricity, hence the beginning of my hypothesis. It can also rub against itself since cloth is not flat and rigid. Also if this happens during the use of treadmills then the possibility is even higher since treadmills are practically always under friction. Frictionless situations don't commonly exist in real life, only in physics exercise problems.
Well, seriously, I don't know if there was a reason to get all hot headed around here but... there is one VERY simple way to test if it's microphonics:
With your earphones worn, try tapping, flicking, or rubbing the cables onto some surfaces. If that's what you were hearing, then it's easier done than said: microphonics. Same concept as the paper cups & cord 'telephone'.
But microphonics isn't really an occasional and random encounter. It gets pretty annoying...
Whatever the case, avoiding microphonics is always a first step when doing exercise (or using IEMs), so tinyman's tips will be useful if ever you have trouble with that.
Those M9 look like they have cloth covered cables, from the pictures on Newegg. I personally do like cloth covered cables but they do tend to rub more easily, so as
might your chances of generating static (electricity). The NE700X might help by having rubbery cables.
That said, if it is indeed the work of static electricity, your cord is generally not the main culprit but your clothes, so the cables are not going to completely solve your problem. Not telling you to change anything at this point, but just to let you know that if sitting still with your music player in your hands does not generate this problem, then your headphones are not the culprit (part of your original question).
If ever the audio is cutting off at times, and quick succession of this causing what seems like a static sound, then your cables are dying (usually near the plug or the earbuds themselves). You can try applying some pressure about these places to see if you can recreate the problem. You can also apply pressure sideways on your IEM plugs themselves rather than the cable strain relief sections when it is plugged in to your phone. If you get audio channel cuts with this last test then the output jack on your phone is loose.
Edit: Also FWIW I never meant to say the noise literally stounded like "static" but, more the closest thing I can think of to describe it would be like radio static when you put your radio on a frequency that isn't being used locally.
Static can produce that sound but more often with than without popping IME.
Loose connection on jack/plug/cable can cause this but it's more likely for the sound to cut completely.
Now to ask something completely crazy but, do you remember the tracks where you experienced this? It could also be the song itself, whether intentional sound effects or bad recording or low quality file.
If ever any other digital/electronic devices is put in immediate proximity to your phone then it could possibly even be interference but... probably not the case. I can't imagine you'd pack too much things in the same pockets while doing exercise!