The work described in the next preceding section may be done at the expense of the county doing the flood control work, or of any district or agency therein which is doing the work. The legislative bodies of the counties and cities affected may provide by agreement that the work be done at the joint expense of the county or counties and city or cities in which the work is done.