In California the reason is revenue and control.
There are significant criminal penaties and fines for not "Properly Storing" a firearm. If a burglar gets your gun, it is highly likely you did not "Properly Store" it. Be prepared to pay the penalty.
Of course this section of "Law" is never enforced if a cop has his gun "stolen" or his kid kills someone with it. Be prepared to pay for his extended vacation at full pay and bennies.
“Properly Storing”
Yep. People said, “So, what? No one knows how I store my gun.” Well, they do if it is stolen and reported.