A few ways.
First, keep in mind nobody 'farms gold'. They farm things for gold. And if they're getting paid to do it (as in, a job), they'll do it a lot, and if all they're doing is just farming day in, day out... not raiding, not questing, not going offline, not doing anything but farming, it tanks the prices of things they're farming so that people who just play the game (or people who farm perhaps one day a week to pay for raids or w/e) so those people make less gold.
Secondly, it makes it harder in general to farm some things, depending on what it is.
Ignoring all the various illegal stuff, like having accounts compromised, banned, not getting money/gold, etc.