The only reason email spam is illegal is because it is an open protocal. A forum however, is a privately run site with it's own TOS and interests. There could be a forum that likes and allows spam. So how could spamming forums be illegal?
The difference between spamming email (illegal) and spamming forums (legal) is a forum runs on a private server and is controlled and created by the private owners who can restrict access to any person and close sign ups, have invites only, or paid membership etc. whereas anybody can create an email and send to anyone through an open protocal. Therefore, the only consequence spamming a forum can bring to you is a banned account and ip. However, if you repeatedly spam a forum in a malicious amount and get caught, they can sue you for obstructing there business (I forgot the exact term lol)
So yeah. Forum spam isn't illegal in the united states (or at least that's my understanding) I am not a lawyer so don't quote me.