Churches are tax exempt, not because they are charities or that the government considers religion to be a charitable cause, but because their organizational and financial structure is that of a non-profit agency. Any organization can file under this non-profit status, it has nothing to do with anything the organization does, it's strictly based on how their finances operate.
What is the difference between nonprofit and for-profit companies? "[a non-profit organization's] income is never to be distributed to any owners 'but is to be recycled back into the nonprofit corporation’s public benefit mission and activities.' "
Churches often have less strict government oversight over their accounting when compared to other non-profit organizations.