Theoretically, links are for moving the user from one place to another, say from one page to another page. Buttons are for actions, like save settings or delete item.
But in reality, they mix. And they tend to be different and the same, depending on the user interacting with it.
Let’s say you want to delete an item. This is an action which makes a change, so it can be a button. And once clicked, it usually displays an alert dialog with two actions, usually “Delete” and “Cancel”. And here is where a exception is made. Clicking “Delete” will trigger the effect of deleting, but clicking the “Cancel” button will not do anything basically. So it can be a link. But since this became an informal standard and people expect it this way, this is the way to go usually. Unless you are Google or Facebook and have the chance to change a little of that behaviour.
I could even go an think that delete button followed by a dialog, doesn’t even do an action, just shows the dialog. But a link (Cancel) and a button (Delete), isn’t something you see everyday so it might seem abnormal. But again, this is only because of habits people using it have.
Then there’s also the need to attention. When having multiple buttons next to each other, they all compete for attention and also clutter the space. An example for this are the “Like, share, comment” buttons on Facebook. Or any place where multiple actions are available one next to each other.
So for people looking for black and white rules this might seem strange. But it’s actually not because it’s all shaped by human behaviour. And as we all know about ourselves, we don’t always react consistent to things. It depends on the mood, a recent experience, context where we are, how tired or fresh we feel, if we are under pressure and so on.
I guess a rule to point out is that we are building things for people to use and it’s mostly people that shape how something should work, if we want for things to go well.