There is nothing wrong with it as long as they don't profit from actions that could lead to collection. If a massacre happened in a Walmart because no armed people were allowed in the store, I would suspect Walmart would be in trouble.
And I say again, you must have and insurable interest to get a policy. In other words, you can't take out a policy on a complete stranger so you receive money when they die. I don't believe this is something that is subject to state to state regulations but is a national thing.
My best guess is Walmart had an insurance policy on a department head which the person signed for, this was not something that was done secretly.