While other answers are thorough in possible reasons, it is worth addressing the alternate:
Not all games forbid real-world trading.
World of Warcraft and Lord of the Rings Online are two examples where the economy has been changed to allow player's to acquire in-game currency with real-world currency. In these cases, the developers enforce using game time as the "middle currency". If you want to purchase money, you simply buy a time card, and sell the time for money.
Some might argue that this is not real-world trading, but the difference is semantic. Ultimately, you can use your real-life money to legitimately obtain in-game currency, and as a result, anything that can be traded for said currency.
In contrast, Diablo 3 offers a good example of a situation where real-world trading was welcomed; and it did not turn out very well. On release, Diablo 3 featured a real-world auction house that gave players the ability to buy and sell items for real money.
Ultimately, this mechanic was removed from the game; but not at great cost. Since the mechanic was a "day one feature", the in game economy was based on an assumption that real-world trading would always be an option. Economy is a delicate thing - even in video games - for reasons I won't go into, in this answer. As a result, the entire in-game economy needed to be re-balanced to accommodate for this large scale change.
This economy change took a lot of resource. In fact, at first, lead developers were quoted as wanting to make the change, but inevitably feeling that it was impossible due to the required workload. Blizzard ended up losing a lot of money, spent on a complete overhaul of the in-game economy. IIRC, this actually resulted in low profit for Diablo 3; despite breaking records in sales, it all went into fixing the mistakes of building in a real-world marketplace.
This is a good example of "pay heed, weary MMO developer". Not only did the inclusion of the real-world auction house lead to a lot of "free1" work and lost profit, but content cancellation; with the now-low profits, the second expansion was inevitably cancelled, with content already created progressively released as free DLC.
1 Free, in that the developer paid for it to be done, but pushed it to the game as a free update.