The simple definition is having sex with anyone under the age of consent
, with the government under the assumption that anyone under that age can not make intelligent decisions for themselves.
If both lovers are under the age of consent
, statutory rape is defined by an age difference, in my state its 4 years.
This way an 18 year old having sex with a 17 year old isn't considered statutory rape. The numerical age difference holds precedence over the age of consent