That's a little bit how the law works. If you get sentenced for a conviction, your good deeds will affect the decision. Sometimes people get off entirely based on who they are (e.g. athletes, execs, etc).
In that one circumstance. You don't get to do a little murder because you donated to a charity. Why even bother to act like this is some sort of principle that underlines the legal system?