Section 27. The district court may impose the same penalties as the superior court for all crimes of which they have jurisdiction, except that they may not impose a sentence to the state prison; provided, however, that the divisions of the juvenile court department shall have the authority to hear cases and impose penalties in accordance with the provisions of sections fifty-two through eighty-four of chapter one hundred and nineteen, and section one through nineteen of chapter one hundred and twenty.