There are many forms of taxes that an organisation may pay. There are the income taxes that are taken from its staff's wages, there are sales taxes on items that it buys and sells, there are land taxes on the property it owns and finally, there are taxes on the profit that it makes. When we talk about an organisation paying taxes we tend to think about the last one, but we should remember that this is only part of the tax contribution that it makes. In this answer, I use "church" and "pastor" as a shorthand for other religious groups and leaders. So "church" may actually be "temple", "mosque", "synagogue", and "pastor" may mean "iman", "rabbi" etc.
Generally, churches don't pay tax on profit, because they don't make a profit. They don't have shareholders who benefit from the profit of the church.
Churches do usually pay taxes on the wages of their pastors, deacons, bishops and other paid workers for the church. Pay for pastors is quite low (considering the amount of training that they receive) but it is taxed.
Churches also pay sales taxes, but often are exempt from property tax. This is because the church building is not a profit-making venue
Insofar as a church is functioning as a charity, it benefits the government not to tax it. The counter-argument is clearly that some "churches" are actually profit-making organisations in disguise, who use the veneer of "religion" as a way to avoid tax. without benefitting their communities.