Is it illegal for a business owner to tell customers not to come back before they sell it?

No, it is not illegal for a business owner to tell customers not to come back. It is their business and they have the right to refuse customers especially if they are selling the business.