If any person accused of a public offense is taken before a judge in chambers for the purpose of entering a plea of guilty and receives a state incarceration sentence, the county where the alleged offense was committed shall reimburse the sheriff pursuant to §§ 7-12-21 and