It can happen, when a state-run prison sends inmates to a county-run jail and pays a boarding fee per prisoner. The state is paying the money, but the county jail is making money, so much so that some are building bigger jails to take on more state prisoners as a revenue source.
“In Oklahoma, for instance, where 25.5 percent of local jail beds are filled by state prisoners, sheriffs receive $27 per day for each inmate they hold for the state — making up as much as 7 percent of some counties’ budgets.” source: https://theintercept.com/2016/06/09/local-jails-profit-from-warehousing-state-prisoners/
“The money that the state pays for locking up state prisoners in local jails has supplanted the role of coal as a revenue source for county budgets,” source: https://ohiovalleyresource.org/2019/03/05/profiting-off-prisoners-state-inmates-mean-big-bucks-for-local-jails/