It probably varies from state to state, I don't know.
Whether or not it’s legal is another question. And NIMBY and… and… there are lots of potential concerns. But this article is about Wisconsin, where the question is really what are we going to do with this land and how are going to power it.
Your post mentions a lawsuit near you. This is a feature, not a bug. Even if the city is unlawfully denying an application, the denial still has the desired effect — a de facto denial for the length of time it takes to resolve in the courts. By dragging out the time for a lawsuit to be resolved, the city hopes that the developer will just go away and find someplace else.
Cities are bound by laws, and not complying opens them up to lawsuits which the taxpayers pay for. Sure, maybe that's in the best interest of the community in some cases. However, I think it usually happens because people have feelings and biases rather than as a calculated move.
They absolutely can and do this. Ask to put an adult entertainment store next to a school/church. Ask to put a liquor store next to a school/church. The city will say no.