ERC20 tokens are a type of cryptocurrency framework; this means that as a whole, their concept is legal, but some developers may use the framework for illegal things. ERC20 standard, itself, is not illegal.