This part of the tax exempt code is for CHARITIES and the organization must be doing some kind of charitable work to qualify ...hence donations made to 501(c)(3) organizations are deductible from personal income tax.
Note there are some other tax exempt organizations that CAN legally lobby particularly those approved under 501(c)(6)...for example industry trade associations. If an organization wants to lobby and remain exempt from federal income tax they can, but donations to that organization are not tax deductible.
Of course, we have seen in recent years that some animals are more equal than others. Bubba, Jesse, Al, and that ilk routinely held what can only be called partisan campaign rallies in ostensible houses of worship.
As long as the "right" people benefit, the practice will continue.
Frankly I hope they do revoke the Church's tax free status, because then the Church would be free from the corrupt influence and pressure that the government exerts on it to remain silent on issues that affect not only our lives, but our souls. The Church would feel free again to speak its mind about evil, something that exists everywhere, even in the IRS.