The court is authorized to have the money and funds in the hands of clerks and receivers, or trustees, in litigation or under the control of the court, invested under such rules and orders in each case as may be legal and just.