There are several municipalities in NY State which do exactly that. They have run their own power companies for a century or more. Statute allows them to buy electricity at a wholesale rate, and they sell it at cost plus expenses. It's very attractive for folks living in those places to own EVs and have all home appliances, including heat and hot water, to be powered by cheap electricity. It's also a feature used to attract businesses.
https://www3.dps.ny.gov/W/PSCWeb.nsf/All/03627EFC626529EE85257687006F39CD