Scientology had no problems getting their initial tax exemption status. While the layman has no problem defining religion, its actually far harder to define both in the literal sense and particularly so as it applies to tax law. Whatever definition you come up with will inevitably exclude one or more mainstream religions. They lost their tax exempt status because of their political positions, criminal activities, and funneling large sums of money to individuals like Hubbard. The problem there is you have no shortage of Christian organizations doing the same things. As such the IRS couldnt just summarily dismiss all of their lawsuits.
The biggest problem is the tax laws grant religious organizations tax exempt status simply for no other reason than being a religion. The assumption is religion is assumed to benefit the community. If religions had to prove benefit to the community like all other non-profits do, they wouldnt be able to pull off their shenanigans to begin with.