Niccolo Machiavelli is best known for his idea (which was groundbreaking at the time) that a ruler should not worry too much about morality. He said that rulers should, instead, do whatever was necessary in order to maintain their power and the stability of their reign. The quote you mention fits in perfectly with this idea.
What your quote means is that people will be less likely to rise up against a ruler if they fear him than if they love him. That is why it is "safer" to be feared. Machiavelli is saying that rulers should not really care about whether their people like them. As long as the people are afraid of them, they will not rise up.
So, the quote you give is very much in keeping with Machiavelli's major ideas. He is saying that keeping people in fear (whether or not it's moral) can be the best way for a ruler to hold on to power.