The use of Artificial Intelligence (AI) in Internet of Things (IoT) systems has gained significant attention due to its potential to improve efficiency, functionality and decision-making. To further advance research and practical implementation, it is crucial to better understand the specific roles of AI in IoT systems and identify the key application domains. In this article we aim to identify the different roles of AI in IoT systems and the application domains where AI is used most significantly. We have conducted a systematic mapping study using multiple databases, i.e., Scopus, ACM Digital Library, IEEE Xplore and Wiley Online. Eighty-one relevant survey articles were selected after applying the selection criteria and then analyzed to extract the key information. As a result, six general tasks of AI in IoT systems were identified: pattern recognition, decision support, decision-making and acting, prediction, data management and human interaction. Moreover, 15 subtasks were identified, as well as 13 application domains, where healthcare was the most frequent. We conclude that there are several important tasks that AI can perform in IoT systems, improving efficiency, security and functionality across many important application domains.