For Sony's specific case, it's because Sony has proprietary technology (X-Reality color management, BIONZ image processor, active noise cancelling techniques) for its stock camera that uses DRM security keys. When the bootloader is unlocked, the keys that reside on TA partition are removed, thus disabling the features. The use of proprietary technology also means that those features are unavailable on 3rd-party apps, regardless of locked bootloader or not.
Quoted from XDA Developers - Restore Functionality on Unlocked Xperia Devices,
If you unlocked your bootloader on a recent Sony Xperia device, you probably know that the potential loss of warranty is not the only disadvantage you have to accept. Another fairly hidden issue is related to various proprietary features such as the X-Reality color management, BIONZ image processor and the active noise cancelling techniques.
Once you decide to unlock your bootloader, the process also removes a piece of data referred to as the DRM keys. These are tied to various services (such as streaming video and the like) offered by Sony but are also required for the features mentioned above to work properly. Put simply, once the keys are gone, you’ll face issues such as decreased low light camera image quality and the lack of the X-Reality mode.
Note: I can't say for LG's case, since I couldn't find any issue with unlocked bootloader and camera. The only things I found were LG G3's stock camera also use proprietary technology and LG G4's camera is not affected by unlocking bootloader, which seems conflicting this answer if the issue is solely caused by DRM.