Counties and municipalities within this state are authorized and empowered to establish, erect, operate and maintain homes for the care and treatment of dependent and neglected, unruly and delinquent children, and to purchase services from any agency, public or private, that is authorized by law to receive or provide care or services for children.