If depends on how easy the boot loader is to unlock. Google Pixel phones have an unmolested boot loader, Motorola(Lenovo) will let you unlock it for non-Amazon Prime/carrier-subsidized phones in many but not all cases with a code and ADB over USB.
Samsung will void warranty if a non-signed ROM is installed - it will trip the “warranty fuse” in Knox, their security platform to allow Android to play nice(comply) in corporate settings.