Sometimes they’re built next to hydroelectric dams and use the entire power output of the dam. Usually with long term power contracts that are more about constant load than consuming excess peaks (having a larger base load is more of an old school energy efficiency benefit, having users for variable loads is the future)
They don’t shut down entirely because the aluminum has to stay molten at a thousand degrees, but they can scale the energy usage significantly, this is becoming more of an interest in the last decade.
https://www.greentechmedia.com/amp/article/german-firm-turns...