It said that in the year 1880, the age of consent used to be 10 in a lot of states. But I think that back then (pre-industrial age) people were still arranging marriages for their kids. So basically kids from different families marry each other so that families could join together for economic reasons. Not 40 year olds marrying 10 year olds, that would have to have been considered wrong no matter what century you are talking about.
As for today, age of consent of 18 only appears to be the law in 12 states. The age is 16 in 30 states and all of Canada.
A lot of states where the age is 18 will have exemptions if both parties are under 18. Otherwise they would be arresting high school sweethearts all over the place.
In AZ, technically it is still illegal for two people under the age of 18 to engage in sex with each other, although the law provides for a defense in that case. But that means you could still get charged with that crime, then you can use that defense. Not exactly the same thing as saying that it is legal.
What is considered a class 2 felony here may be perfectly legal in Colorado, New Mexico, Nevada, etc.
The only difference is that you need to be standing on the other side of an imaginary line in the ground.
On one side of the line, you are under arrest and going to prison. On the other side of the line, the cop will say "carry on."