It depends on the device, but at least on Nexus/Pixel devices you can just plug the phone in and `fastboot oem unlock` and it will unlock the bootloader, i.e. allow you to flash anything onto it that you want.
This does not let you access the user's data because fastboot oem unlock wipes the data partition. Before you can unlock the bootloader, you have to enable the option in the developer menu, which requires the phone's owner's account's unlock code.