Where an inmate is in a State correctional institution either because of the inmate's sentence pursuant to the inmate's conviction or plea of guilty to a criminal charge or because of a commitment issued by any court of the Commonwealth having jurisdiction and, while so confined, the inmate commits a criminal offense and is subsequently convicted or enters a plea of guilty, the expenses of keeping the inmate in any State correctional institution pursuant to such subsequent conviction or plea of guilty shall be borne by the Commonwealth.
61 Pa.C.S. § 1164