Section 62M. The trustees may, upon application of any child entitled to receive the benefit of said school, or upon such application by a parent, guardian or person having the legal custody of the child, or by any state or municipal department, board or officer having such custody, admit such child to said school, subject to such rules and regulations as the trustees may prescribe, and the trustees may discharge such child from the school; provided, that no such rule or regulation shall prohibit the admission of a child for the reason that he commutes to said school or that he is able to pay the charges for his support at said school. The charges for the support of the children who are of sufficient ability to pay for the same, or have persons or kindred bound by law to maintain them, shall be paid by such children, such persons or such kindred at a rate determined by the executive office of health and human services or a governmental unit designated by the executive office. The board of such children as reside in a town shall be paid by the town at a rate not exceeding seventeen dollars and fifty cents a week, notice of the reception of the children by the trustees being given by them to the town as soon as practicable; and the tuition and board of those having no such settlement shall be paid by the commonwealth. The trustees may receive other children having no means to pay for tuition and support, and the tuition and board of all such children shall be paid by the commonwealth. The attorney general and district attorneys shall upon request bring action to recover said charges in the name of the state treasurer. The admission of a child as aforesaid to the school shall be deemed a commitment of the child to the care and custody of the commonwealth, and the trustees, with the approval of the department, may detain the child at said school during its school age, or for such longer period during its minority as in the opinion of the trustees will tend to promote the education and welfare of the child.