The dm can cheat to win yes. That is also the lesson. Which means trying to beat the game is a hopeless goal. And if you think this is the game, you're gravely mistaken.
The comparison to flogging is simply dumb. It's completely irrelevant.
Now you can be a dumb player and refuse to learn anything from this encounter. It can spark a discussion then.