Houston County should be getting more than $35,000 from the Alabama Department of Corrections.
The money is for housing state inmates beyond a 30-day limit for the prison system to accept them.
Sheriff Lamar Glover challenged state officials a year and a half ago when he began an unannounced transfer of state inmates to prison.
Glover wanted to ease overcrowded conditions in the Houston County Jail.
A videotape of too many inmates sleeping on the floor of the jail was introduced as evidence during the legal battle that followed.
Friday's ruling by a Montgomery circuit judge requires the prison system to pay $26 per inmate per day for thousands of prisoners who were housed for months in county jails beyond the 30-day limit.
Checks totaling more than $2 million could soon be in the mail to almost every county in Alabama if prison officials decide not to appeal.