I have three answers, of ascending mootness.
A
If the virtuous acts are a lie in the sense of the politician appearing to do good only so they can do something monstrous, then no I think it cannot be said he or she can be credited with the goodness of the first act. I think a less extreme example is that worthwhile behaviour in one domain can leads to e.g. freeriding in another. I have forgotten the term for this.
B
Certain rewards may perhaps be such that despite their overwhelming value the recipient can be credited with the action that leads to them. I am thinking of e.g. Kant, who claims that reward in heaven is necessarily postulated in practical reasoning, in deciding how to behave.
Kant argued that practical reason requires that people believe in God and the immortality of the soul including reward and punishment in heaven.
The journey of modern theology p88.
We are to be motivated by the postulation of the coincidence between virtue and happiness, which seems to include the hope of personal reward from a beneficent God.
Similar things can probably be found in other religions; e.g. in Buddhism good karma associated with an act doesn't make the act neutral.
C
Finally, allow me to suggest that while there may be such a thing as a guilty mind, or immoral motivations, these have to be transparent to the agent in order to count against him or her. In the same way it would be quite odd to say that someone deliberately did something awful without knowing that they intended to do it, symmetrically, it may be that someone can only be motivated by e.g. greed if they know that they are.
And actually one's motivations may be pretty inaccessible. Quite famously, Nietzsche claimed that we can't rank acts according to motivation, but his answer was to throw out all morality or at least all vast amounts of it. Perhaps he went too far, and the pejorative should be on damning covert rewards.