When any person has been adjudged to be a ward or dependent child of the juvenile court, and the court has made an order committing such person to the care of any association, society, or corporation, embracing within its objects the purpose of caring for or obtaining homes for such persons, the county in which such person has been committed may contract with such custodian, for the supervision, investigation, and rehabilitation of such person by such custodian, and may, pursuant to such contract, pay to it an amount determined by mutual agreement, not to exceed the cost to such custodian of such service.