The gods are a bit smarter than that. At least the Good ones are.This doesn't mean that there will not be clerics who are corrupt.
The purpose of having no alignment restrictions for clerics is to make the campaign more realistic.
In game terms, a Devotee of Hexor hiding within in a Heironean sect in order to bring it down from within would not be worshipping Heironeous but Hexor, and thus, would be receiving his powers from Hexor. Unless and until he revealed himself, he might appear to be a member of the faith, and even a real player in the hierarchy.
But the source of his power would NOT be the divinity he is only pretending to worship.
Even if you posit that deities have a dark side that attracts certain people to a twisted version of their faith, then there's this little thing called "Detect Evil" that D&D faiths have to deal with. Historically, this has meant that "evil priests have their own sect" that the good followers and priests don't normally interact with.
Last edited: