As can be seen from a simple look at the Wikipedia page on "impact factor" ("IF"), the IF measure is not ideal. First, due to the very different nature of research fields, papers may be quick to publish, or take several years. This will affect the IF a great deal - to the advantage of "fast" papers, while not actually saying anything about the importance or influence of a paper. Also an individual paper cannot be assessed this way, as the IF measure is a measure of the output of a journal, and not a measure of an individual paper. The Wiki page also explains how a journal can falsely raise its IF automatically, by publishing many survey papers, or publish a lot of papers at the beginning of the year, Further, after acceptance of a manuscript, the journal editor can ask the author(s) to add citations to additional papers from the same journal - something I have been asked to do on a few occasions - and that will also (falsely) exaggerate the impact of a journal.
Journal publishing is not *always* a morally acceptable business ...