Does Kant every justify punishment of criminals? For example, is it obligatory for governments to restrict the action of a murderer after they have murdered? Furthermore how can Kant's "principle of equality" be reconciled with treating people as an ends only? Punishing an individual to restore equality seems to be using them as a means to an ends.
Much of what you seek is in Doctrine of Right which is the first half of Metaphysics of Morals (not Groundwork of the Metaphysics of Morals). E.g., Kant believes in capital punishment for murderers.
There, Kant stated:
Even if a civil society were to be dissolved by the consent of all its mem- bers (e.g., if a people inhabiting an island decided to separate and disperse throughout the world), the last murderer remaining in the prison would first have to be executed, so that each has done to him what his deeds de- serve and blood guilt does not cling to the people for not having insisted upon this punishment; for otherwise the people can be regarded as collaborators in this public violation of justice. (6.333)
I think Kant sees it as consistent with treating people as ends, because murderers have committed the moral evil of wiping one of those ends from the earth. Moreover, it is that you must treat them as ends and not mere means. And capital punishment is not a means to a different end, but an embodiment of justice for Kant.
Moreover, it's an implementation of the universalizability schema. i.e., the murderer wills that human life should be snuffed out. Ergo, his maxim is made universal for him.