Yes, it is legal to use employer of record services. They allow companies to legally and efficiently hire staff in a new country without having to set up a separate entity.