This is an interesting topic, actually. There is biologic maturity, which is not a focal moment, but actually a span of time, and it varies from person to person. And then, there is legal maturity, which is defined by the social, legal convention, and is at an exact age in time. And finally, there is the issue of a teacher's responsibility as a teacher and adult.
We all can understand that being 17 years and 354 days old does not necessarily make you a baby, and that being 18 years and 1 minute old does not necessarily make you an adult. But that is what the law says. So, biologically, many underage teens are perfectly able to understand sexuality and to responsibly engage in sex. Not too long ago, a minor could storm a beach, rifle in hand, and die for his country. No one had a problem with that. But it would be a problem for him to choose to have sex with someone say, 19? And yet, according to the law, the 19 year old would be "raping" the minor. I personally think that in a lot of cases of underage males engaging in sex with their teacher, they are perfectly OK with it and may have been the party that looked for the relationship. I personally don't think that most teen boys close to age 18 are being done some irreparable damage in many of these cases. Their parents may think so and be outraged (and that is usually theatrics so that the subsequent civil lawsuit against the school district gives them plenty of money. They know their kid is sleeping around with everyone, but sleeping with the teacher lands them a payday)
That said, then comes the responsibility of the teacher. Every teacher knows very well that there are boundaries that should never be crossed and one of them is getting romantically or sexually involved with a teacher. If they do, they should be punished.
So, what should be done? One, putting a person in prison for years for this is a waste of taxpayer's money. Ban them from contact with children and place them in a supervised setting where they can work, be productive, and of course, pay for any expenses their victim incurs as a result. Two, no "punitive" damages to school district. Dad getting a Corvette and mom getting a boob job should not be financed by cash-strapped school districts. Have the teacher involved work to pay for whatever treatment the victim needs.