In Bitcoin, you can use an OP_RETURN output to encode arbitrary data in a transaction output.
But there are also ways to do it without really saying something arbitrarily. For example, you could cut the data into segments of 32 bytes and claim that it is a public key. For an outside observer, it could very well be a public key. Then, the person coding the data creates a large number of P2PK outputs or a large naked multisig output with public keys that are actually data.
In order for the data to be placed in the chain of blocks, they must normally be transformed in some way (for example, cut) and must be interpreted especially to be able to extract the encoded data. That someone has coded illegal information in the chain of blocks is not a new idea, but to really get the illegal information, you need a special decoder, otherwise it's just arbitrary bytes.