But outside of that, a hiring decision made based on a personal relationship is considered cronyism. It isn’t always illegal, but most HR departments go out of their way to prevent it.
“It’s not what you know, it’s who you know” is terrible career advice in general. It can be incredibly seductive because it promises people an advantage over competition. But it’s wrong. It’s a waste of time and in my experience, the people who follow it tend to interview poorly because they come off as arrogant and complacent.