The rules by the International Ice Hockey Federation (for men at least) says this -
Basically, there's a penalty for fighting. I think it's the same in the NHL and I'm unfamiliar with any other leagues.
In most other sports that aren't actual fights (like boxing), players almost always get ejected for throwing a punch, even if it doesn't connect.
Obviously it's tolerated because the rules don't say it's not tolerated. I'm asking why this is the case.