The county legislative body of any county and the chief legislative body of any one (1) or more municipalities lying within the boundaries of the county are authorized and empowered to enter into any such agreements, compacts or contractual relations as may be desirable or necessary for the purpose of permitting the county and the municipality or municipalities to conduct, operate or maintain, either jointly or otherwise, desirable and necessary services or functions, under such terms as may be agreed upon by the county legislative body and the chief legislative body of the municipality or the chief legislative bodies of the municipalities.