If a prisoner is committed to a county correctional facility under section 3322(2) (relating to commitment pending trial) or 3323(2) (relating to commitment after trial), the expenses of maintaining the prisoner during confinement shall be paid by the borough, and the county shall not be liable for the maintenance.