In my case it's mostly the latter that drives me nuts and happens very frequently.
LinkedIn's official Community Guidelines[1] have this to say under the section "2. Be Professional" -> "Honesty and Authenticity":
> Do not invite people you do not know to join your network
You used to be able to report people for abusing that policy by saying "I don't know this person" after you declined the invite. However, LinkedIn are phasing that functionality out[2].
If LinkedIn wasn't overflowing with incessant spam, then it could actually be a valuable service for professionals. However, it's mostly a waste of time because there's zero quality control.
[1] LinkedIn Community Guidelines - https://www.linkedin.com/help/linkedin/answer/34593?lang=en
[2] Removal of "I don't know this person" - https://www.reddit.com/r/linkedin/comments/ccaky7/linkedin_r...