Nothing is legal. Even OEM can be illegal depending on the cop you encounter, his mood, his wife's headaches, his lunch, his coffee, what he stepped on that day, etc..
Stick to OEM or OEM replacement and you have less chance of a ticket. Magnaflows aren't illegal, but the cops will tell you they are.