A district may enter into contracts with municipalities, water districts of any type or kind, counties, cities and counties, the State of California, or the United States, under such terms as may be mutually advantageous, for the acquisition or construction of the works authorized by this division, and each of the parties to such contract may contribute to the cost of such acquisition or construction such sums of money as may be agreed upon. Such contracts shall provide for the operation and maintenance of the works thus acquired and for the distribution and sale of any water that may be stored or controlled by the parties thereto. Any surplus revenue derived from such sale, after paying the cost of the operation and maintenance of the works, may be distributed to the parties to the contract in such proportions as may be agreed upon, or may be used for extensions and improvements.