In the United States, sewage is required to be purified to high standandards before it can be released back into the environment. Furthermore, no matter how much it's purified, it may not be used as drinking water... however, nothing prevents purified wastewater from being used as a power source to
generate drinking water from seawater.
How would this work? Simple:
Build a desalination plant directly next to a wastewater treatment plant, and send the purified wastewater to the desalination plant.
Use a pump to pressurize seawater, and send it through a reverse osmosis device.
The freshwater produced is of course drinkable, as it came from a natural source (the sea).
Then, pass that high pressure brine that's left over through a forward osmosis device, with wastewater being pumped in as the source of "fresh" water. This increases the volume of the saltwater, without decreasing it's pressure.
Pass the now dilute saltwater through a turbine, to generate energy to drive the pump that pressurizes the seawater, and to drive the pump which pressurizes the wastewater.
If the plant creates a smaller volume of freshwater, than the volume of wastewater that it consumes, it should be possible for the system to generate more power than it requires.