It's not about the men being treated more harshly, it's about the female teachers not being treated harshly enough. They both deserve to be punished, and with the same amount of public outcry. (Though there may be some debate when it comes down to a physically overpowering assault VS a drawn out psychological grooming process and how gender plays a role, if any)
But if you're going to blame anyone, maybe blame the other men themselves, the ones that help write the narrative of how a female teacher "offering" herself sexually is some type of godsend to a young boy. They help open the door for this type of thing to even happen and for the victim to feel like they can't complain about it, that they should be glad of it. The same ones who say that if the teacher is attractive, what she did was a gift. (If the teacher is old and objectively unattractive, you are not going to get the same response). Those are the people causing the split in the atmosphere after an event like this occurs.
Now it's not just to do with the sex of the teacher, but that of the student. If a female teacher has sex with a female student or a male teacher has sex with a male student, the general public will usually be just as disturbed as when the teacher is male and the student is female. They will condemn them for exploiting their position of power to sexually assault or molest a student. As they should, even if a certain portion of them will act all jovial when it comes to the female teacher/male student.
...
You also have to take into account age. The age of the student usually. There's a lot of people who think having relations between a college professor and a college student is fine because they are of age, even though there is still an abuse of power at play as well as interference with the overall workplace and attention to one student vs the others, etc.
And then you have elementary/grade school children, you aren't going to hear anyone being okay with ANY teacher being sexual with a young child unless they wish to promote pedophilia.
So this phenomenon that you speak of usually occurs when the student is still technically underage but closing in on early adulthood, we're talking highschool obviously.
Perhaps the people who applaud this 'attractive female teacher has sex with male student' situation are still stuck in their Highschool fantasies. But they don't realize the incredible difference between fantasy and reality and just because you seemingly want something in your imagination, it doesn't mean the real deal would be pleasant for you. They are projecting their fantasies onto the victim who lived them out, while they didn't actually have to live them out themselves, so their perspective is skewed. And the victim themselves often feels that they have to hold up those fantasies, become the embodiment of them as to not disappoint all these other guys who "didn't get the chance"...so the female teacher may not get so much as a wrist slap, not just from the public (or the law/jury..which will consist of both genders) but from the victim as well. It's a giant mess.
(And ofcourse this sick type of dynamic and thought process can also lead to false accusations for similar reasons, but that's another subject for another day..)