Leviticus 25:50-53

MSB(i) 50 He and his purchaser will then count the time from the year he sold himself up to the Year of Jubilee. The price of his sale will be determined by the number of years, based on the daily wages of a hired hand. 51 If many years remain, he must pay for his redemption in proportion to his purchase price. 52 If only a few years remain until the Year of Jubilee, he is to calculate and pay his redemption according to his remaining years. 53 He shall be treated like a man hired from year to year, but a foreign owner must not rule over him harshly in your sight.