The Internet of Things (IoT) was born from the fusion of virtual and physical space and became the initiator of many scientific fields. Economic sustainability is the key to further development and progress. To keep up with the changes, it is necessary to adapt economic models and concepts to meet the requirements of future smart environments. Today, the need for electronic commerce (e-commerce) has become an economic priority during the transition between Industry 4.0 and Industry 5.0. Unlike mass production in Industry 4.0, customized production in Industry 5.0 should gain additional benefits in vertical management and decision-making concepts. The authors’ research is focused on e-commerce in a three-layer vertical IoT environment. The vertical IoT concept is composed of edge, fog, and cloud layers. Given the ubiquity of artificial intelligence in data processing, economic analysis, and predictions, this paper presents a few state-of-the-art machine learning (ML) algorithms facilitating the transition from a flat to a vertical e-commerce concept. The authors also propose hands-on ML algorithms for a few e-commerce types: consumer–consumer and consumer–company–consumer relationships. These algorithms are mainly composed of convolutional neural networks (CNNs), natural language understanding (NLU), sequential pattern mining (SPM), reinforcement learning (RL for agent training), algorithms for clicking on the item prediction, consumer behavior learning, etc. All presented concepts, algorithms, and models are described in detail.