As Machiavelli explains in Chapter 16 of The Prince, it is better to be stingy, though he notes that it can be advantageous to cultivate a reputation for generosity. However, the lavish displays necessary to maintain that reputation would ultimately prove so expensive as to be disastrous. Thus, for Machiavelli, the prince with the reputation for generosity will ultimately have to at some point raise taxes, and this for Machiavelli is a critical error, because raising taxes is something that will earn the enmity of one's subjects. One of the critical calculations of Machiavelli's thought is that the ruler must be careful not to become hated. Thus, for Machiavelli it is far better to be stingy than to be generous.
That being said, this advice does have a critical condition to be aware of—and that condition is in military considerations. As he tells us in chapter 14, "a Prince . . . must not have any other object nor any other thought . . . but war, its institutions and its discipline." (The Portable Machiavelli, ed. & trans. by Peter Bondanella & Mark Musa. United States: Penguin Books, 1979, p. 124) From that perspective, as important as it is to be stingy, this would not extend to matters of military expenditure, because princes should make whatever investments are necessary to secure their military capacity. These thoughts are further reflected in his thoughts concerning generosity and stinginess, because at the end of chapter 16, he makes a critical exception to his advice detailed earlier. When it comes to wealth that is taken in war, Machiavelli says that a victorious prince should be generous with it rather than stingy, because that generosity when shared with his soldiers and followers will maintain their loyalty.