There are two sides to this. SE is stuck in a war which is undermined a lot by the fact its their own players breaking the rules which are allowing the problem to exist in the first place. If people didn't buy gold, no one would be selling it.

I play on a Japanese server and have never seen a single RMT ad. There are still quite a few bots but no spaming RMT. The difference to the NA servers sounds profound. Bots are annoying but RMT is what is really invasive.

The issue SE has is that the best way to stop people breaking the rules is prevention. Account security is part of this. Anyone who doesn't have single use password protection should get it. Hacked accounts are a favoured way of RMT sellers to advertise because it allows them access to the game without paying anything. Reporting people breaking the rules help as well. Automated solutions are problematic. Innocent players almost inevitably get caught. This creates a need to investigate individual cases which can become extremely cost inefficient. The other option is being more restrictive which is what WoW mainly does.

There is no easy solution to this and its an arms war. People mention WoW but seem to forget it took WoW years to get their own RMT problems under control. They literally had new characters spawning, being hacked to fly through the air to Orgrimmar and being laid out on the ground to spell the letters of gold selling websites. That situation continued for ages.