The purpose of citing literature in papers is not to give credit to previous work or boost other researchers citation index but to document your statements about the background of your work.
If another paper is very similar to your paper it is advisable to discuss it in your manuscript and point out the differences that makes your manuscript worthy of publication. The alternative is often that the reviewers will mention it as similar to your study and cause your manuscript to become rejected.
The thing with Impact Factor, H-index etc. properly influence us all so courtesy citation does occur, but it advisable to remember it is in principle wrong and if it is overdone it can give negative responses from editors.
I don't think the second part of the question can be answered with a simple YES or NO. A few years back I would have definitely said NO if that paper was not contributing substantially towards either hypothesis generation, execution or validation. However, today even journals ask authors to unnecessarily cite papers with similar theme from their recent issues to help them add on to their Impact Factor. Similarly, today a researcher is evaluated on the basis of his H-index, which could definitely get a boost from courtesy citations. So the question is more about an individual's perspective.
The purpose of citing literature in papers is not to give credit to previous work or boost other researchers citation index but to document your statements about the background of your work.
If another paper is very similar to your paper it is advisable to discuss it in your manuscript and point out the differences that makes your manuscript worthy of publication. The alternative is often that the reviewers will mention it as similar to your study and cause your manuscript to become rejected.
The thing with Impact Factor, H-index etc. properly influence us all so courtesy citation does occur, but it advisable to remember it is in principle wrong and if it is overdone it can give negative responses from editors.