A lot of it is that they can not afford to take them on legally. Scientology had every member file suit individually against them for discrimination, etc. plus they have their whole bag of legal tricks to wear down their adversaries in court. The federal, state, local governments have limited budgets. They just run out of money and throw in the towel. It happened with the IRS, in Oklahoma, probably in little Sandy Spring, GA and so on.
They also don't go to court to win cases, usually. They set out to wear people down until they are so sick of the shenanigans they give in. Corporations have the resources to make lawsuits and appeals last decades.
Probably not what you wanted to hear.