When you act just to avoid punishment, it isn't clear that you're acting morally at all! Think about someone who gives money to your favorite charity, and you think, "Hey, what a great person. How nice." Then you come to find out that this was a condition on their avoiding jail-time, set by some judge who was perhaps a little full of herself. Now, what do you think? Did this person do something good; do they deserve moral credit?
Morality by coercion isn't morality at all.