Leviticus 25
51 If there is still a long time, he will give back, on account of it, a part of the price which was given for him.
52 And if there is only a short time, he will take account of it with his master, and in relation to the number of years he will give back the price of making him free.
53 Ref And he will be with him as a servant working for payment year by year; his master is not to be cruel to him before your eyes.