Whenever any retailer enters into a franchise agreement, evidenced by a written contract with a wholesaler, manufacturer, or distributor wherein the retailer agrees to maintain an inventory, and the contract is terminated, then the wholesaler, manufacturer, or distributor shall repurchase the inventory as provided in this subchapter. The retailer may keep the inventory if he or she desires. If the retailer has any outstanding debts to the wholesaler, manufacturer, or distributor, then the repurchase amount may be credited to the retailer's account.