Whenever, in the operation of a utility, a municipality develops an excess of water, light, heat, or power, over and above the amount which is necessary for the use of the municipality and its inhabitants, or such portion thereof as the legislative body of the municipality determines is to be supplied therewith, the municipality may sell, lease, or distribute the excess outside of its corporate limits.