I always hated this saying. Firstly, the things we do create consequences not punishments and rewards. That’s narcissistic mentality. Doing things for rewards or punishments.
Secondly, if you do a good deed don’t do it for the reward, recognition, love, acceptance, or acknowledgment. Otherwise it’s not a good deed it’s manipulation. Another narcissistic tactic.
If you want to help someone out do it because you genuinely WANT to. Not for rewards. And if people want nothing to do with you it’s a consequence of your behavior. Not a punishment. Life owes you nothing.