There was a chapter in a game theory book I read that talked about this.
It said that rituals and rules can serve as a way to raise the cost of being in the religion, which can help keep people who don't really believe in the religion out. The book had a cartoon showing a man standing in front of a "Church Picnic" sign and he had a thought balloon that said "I'll pretend to love Jesus for a free hamburger!".
The tangible benefits of being accepted as being a member of a church can be considerable, far beyond the occasional free hamburger at a church picnic. Members of a church will often when they need services or need to buy things look first to providers that are in their church.
If all it takes to convince them you are one of them is showing up at services occasionally and giving a small donation now and then, that is a price many non-believers would pay.
Annoying rituals and rules raise that price. For the true believers who are in the church because they believe that it is the only way to not spend an eternity being tortured in hell, church is worth it even with the onerous rituals and rules.
For the person who is only there because he thinks it will get him a few more customers for his landscaping business, the rules and rituals can make it not worth it.