Let's be clear - it is NOT illegal for a private owner to install a lock on the propane compartment. The manufacturer probably follows NFPA guideline 1192 which is fire safety for RVs and recommends against a locking propane compartment. Note that this is a guideline, not a law,
That being said, it has been pointed out that there are good reasons not to lock the propane compartment and times when you may want to lock it. As a compromise, I installed a combination lock on the propane compartment of my Hawk:
https://www.amazon.com/Combi-Cam-7850R-XL-Combination-Chrome-Finish/dp/B005OAWOAK/ref=sr_1_1?ie=UTF8&qid
I leave it unlocked most of the time but lock it when I will be away from the camper for a long time and it's parked in an area with a lot of people. I also make sure to turn the propane off anytime I lock the compartment. I think this is a reasonably safe compromise.