Inmates will count in home districts, not jail districts, judge rules