I don’t know if it’s illegal, but Meshtastic takes place outside the amateur radio bands (using LoRa IIRC) and thus isn’t bound by amateur radio licensing requirements, so the law prohibiting encryption on the ham bands doesn’t apply. Some other law might.