Websites can earn revenue through transactions and build customer loyalty by offering products or services directly to consumers through affiliate marketing and partnering with other businesses for commissions.