Typically this poem is dated from the 17th century and the time of the levellers and of the New Model army/navy. I would suggest instead that its dating is a product of its documentation in the 17th century, and as such is not a dating based upon its original context. As part of folklore it is a product of the folk of the commons culture which dates back to at least the 13th century. This is not to say that it wasn't popular during the 17th century which is the time period when commons customs were intensely criminalized in England.
The law locks up the man or woman