This is - of course - a very rough synopsis of Machiavelli's treatise - even if he never actually said that.
But the other way of looking at his work was that he was the first person to develop a code of ethics that led to the idea of "doing the greatest good to the greatest number of people"
I highly recommend the series from the blog of the this Renaicance scholar and specialist in Machiavelli which I discovered via HN the other day: https://www.exurbe.com/machiavelli-s-p-q-f/
He argues quite compellingly that Machiavelli's work led to classical utilitarianism ethics ("the greatest good to the greatest number of people") since he was the first to consider judging actions on their consequences rather than "what was in someone's heart".