Arthur Schopenhauer said this quote

God, who in the beginning was the creator, appears in the end as revenger and rewarder. Deference to such a God admittedly can produce virtuous actions; however, because fear of punishment or hope for reward are their motive, these actions will not be purely moral; on the contrary, the inner essence of such virtue will amount to prudent and carefully calculating egoism.