Anti-spam legislation doesn’t regulate the technology. It legislates the behavior of the spammers.
This is no different from say, assault, which doesn’t regulate hammers and baseball bats, but makes it illegal to hit people with them without their permission.