Was Machiavelli in a way trying to write a book on morality by subtly exposing political methods in The Prince?
This is highly doubtful. The Prince was written during a time of intense political turmoil in Italy. Machiavelli had been imprisoned, tortured, and later banished by Lorenzo de Medici, a member of the notorious de Medici family and relative of the future Pope Leo X. The treatise is unseemly flattering of Lorenzo, and suggests ways that a Prince might "succeed" in ruling his country. His famous statement (which I often quote to my students) that "it is better to be feared than to be loved if one must choose" hardly sounds like the words of one attempting to expose political methods. Leo Strauss, in Thoughts on Machiavelli commented:
Even if we were forced to grant that Machiavelli was a patriot or scientist, we would not be forced to deny that he was a teacher of evil.
In the last chapter, Machiavelli urges de Medici to free Italy from the "Barbarians." Again, this hardly seems s subtle way to expose political methods. The Prince has been the subject of intense scholarly and literary debate; however I think it is a reach to say it was written as an expose. The more logical explanation is that Machiavelli was attempting to flatter Lorenzo in hopes of restoring himself to the latter's good graces. Such an effort would be truly Machiavellian