All Pixel's are bootloader locked by default, Google retail models can be unlocked easily while Verizon models cannot.
In the comments, you said "The question is how to PROVE it is not a Verizon variant. This phone is model G011C."
The model G011C is the Google Retail version, the Verizon version has a model of GA00152-US. Also, determining whether it's a Google or Verizon version is not difficult by other methods.
Go to the device Settings Menu, About Phone, and tap the Build Number repeatedly to enable Developer Options and then open that menu. If the OEM Unlocking option grayed out and it says "connect to the internet or contact your carrier" then you have the Verizon model.
Obtain the IMEI number and go to Verizon's BYOD Checker site and enter your IMEI number. If it is NOT a Verizon version, the message will be "PIXEL 2 XL NON-VZW" if it is a Verizon variant the message will be "PIXEL 2 XL VZW" or just "PIXEL 2 XL".
Chat with Google support and give them the IMEI number, they can tell you if the device is a Google Retail variant, or a Verizon variant.
And to answer the second portion of your question, "And how to re-lock it for Pixel 2 XL", this is a simple fastboot command away. Just enter
fastboot flashing lock when the device is in the bootloader - Source
All non-Verizon versions can have the bootloader unlocked simply by enabling OEM Unlocking in the Developer Options menu, and using the fastboot command
fastboot flashing unlock. No Verizon version of the Pixel 2 can have the bootloader unlocked by any known method.
Also, I don't know if your original question is mis-tagged or not, but you also used the
sim-unlocking tag. SIM lock or carrier lock is something else entirely than bootloader lock (related to custom ROMs & TWRP tags). No Pixel device is SIM/carrier locked regardless of where it is purchased originally, or even can be SIM locked to my knowledge. Many people bought the Verizon version of Pixel & Pixel 2 outright from Verizon stores as they had them instock and immediately took them to different carriers with no issue.