Just a guess--maybe it has to do with the models of moral development which posit that some people internalize prosociality and others just comply with external pressures to dictate how they will behave.
Or some are doing what they think they must do to get a reward in the afterlife, but at times it's apparent such folks do not actually feel compassion/generosity/etc. inside their hearts.
I have seen this for years in people whose political stance is healthcare should not be "free" for the poor although their god commands them to take care of the sick and poor. They attempt to rationalize this by doing symbolic charitable works/giving. Then when they are faced with a giant bill themselves, they expect the (nonprofit) hospital to write it off.