Scraping Google Maps using =IMPORTFROMWEB() is based on publicly available information. The function accesses data that is openly accessible on the internet. And generally, accessing and scraping publicly available data from websites is considered legal.
Moreover, with IMPORTFROMWEB, the scraping is made using multiple premium proxies and external rotating IP addresses, so you do not have to worry about the possibility to be banned from scraping data Google My Business profiles.
Nonetheless, it remains important to stay informed about the terms and conditions set by Google and exercise scraping responsibly and ethically.