They Went That-A-Way & That-A-Way (1978)
Dewey and Wallace are small-town lawmen who are ordered by the governor to go undercover as prison inmates to find out where a gang of thieves have hidden their loot. While they're undercover, however, the governor dies, and because no one else knows about the ruse Dewey and Wallace are stranded in prison.
Some information and/or images in this header may be provided either partially or in full from The Movie Database.