States and local communities are considering or enacting bans on new data centers due to concerns over electricity costs and environmental impact.