In most states (possibly all) if a child under 18 is married to an adult over 18, their legal guardian changes from their parents to their now-spouse. So teeeeechnically, depending on the situation for the change of guardianship, that could actually be a totally legit loophole. In a very much should never be allowed to happen sort of way, naturally.
Before this gets weird, I only know that because I needed to know liquor laws, as my state allows minors to drink with their legal guardian who is over 21 which does include spouses. Nobody honors that at all (typically not even for parents because it’s really hard to prove legal guardianship), but technically that’s how it works.
So while the guardianship is legal, in the wikipedia article it goes on to clarify legal experts weighed in that it is still illegal to groom, coerce into sex, and give drugs, etc to a minor, even if you are their guardian. That's the illegal part