By midday of the 14th of Nisan, every Jew must have disposed of the ḥametz in his possession. In the past, Jews would plan their food purchases and their meals so that by Pesaḥ they would have finished consuming any ḥametz foods and thus not have to dispose of large quantities. They would leave only a small amount of ḥametz with which to fulfill the mitzva of bi’ur ḥametz in the best possible manner: by burning it.
However, occasionally one’s plan would backfire and he would find himself possessing a large quantity of ḥametz when Pesaḥ arrived. In such a case, if he did not mind losing the ḥametz, he could burn it or give it as a gift to a decent and deserving gentile. If he did not want to lose the value of his ḥametz, he could sell it to a gentile before Pesaḥ, since, as long as the prohibition has not gone into effect, it is permissible to sell the ḥametz and receive its full value. The prohibition against deriving benefit from ḥametz goes into effect on the sixth hour on the day of the 14th of Nisan, and until that time it is permissible to sell the ḥametz.
This was especially important for food merchants who would remain with large stocks of ḥametz before Pesaḥ and had no choice but to sell to a gentile, in order to avoid great financial loss. Even if a gentile could not be found who was sincerely interested in buying all of the ḥametz, the Sages teach that it is permissible for a Jew to say to a gentile, “Even though you do not need so much ḥametz, buy all of my ḥametz for the full price, and if you want, I will buy it back from you after Pesaḥ” (based on t. Pesaḥim 2:7).