He did break the law, Federal law in fact. The penalty for death threats is five years in prison. He committed the crimes but was never arrested, prosecuted, and incarcerated.
He had ‘no record’ that would affect his purchase of a gun..and he lied about his mental health. Nothing anyone would have done would have stopped this shooter as he planned and executed these shootings for a very long time.