The most common method is to create an otherwise normal txn (with any amount of fees you desire) and then ADD a zero value OP_RETURN output. They can be pruned because the only outputs which are needed to validate future outputs are spendable outputs. Normal outputs are pruned once they are spent as a spent output is no longer spendable. OP_RETURN outputs are by definition never spendable so they can be pruned immediately.
To validate transactions requires maintaining a copy of the UTXO. This is a more critical resources than the raw blockchain. Your node doesn't use raw blocks locally for anything other than building the UTXO. The UTXO is used to validate all future txns and blocks. OP_RETURN can be excluded from the UTXO as are outputs once they are spent.