Living or non-living is not the issue.
I travel by plane.
I travel by horse.
I go with style.
I go with God.
"With" may indicate: together, involved, having, using, feeling, agreement, understanding.
"By" may indicate: proximity, purpose, method.
See Prepositions "With," "Over," and "By"
One thing to understand is that these sentences are ambiguous. There is no single perfect way to parse their meaning. You end up guessing.
Sam is angry with John.
When I hear this I guess that you don't mean that Sam is angry and happens to be standing next to John. There is absolutely no grammatical reason that can't be exactly what is meant. That is only understood by implication.
It may also mean that Sam is angry and John is angry as well and we're left to guess what they are both angry at.
Sam is angry by John
This just hits the ear wrong but it could mean Sam is angry and happens to be standing next to John.
Grammar is a good tool but it's not how we sort out this ambiguity. Idioms are. Of all the ways to take it, the popular interpretation wins. But sometimes even that can fail.
The man saw the woman on the hill with the telescope.
Ow! Maybe you see one way to take that. Maybe you're lucky and that happens to be the most popular way. But can you trust that it is? Try counting the different ways to take that. If you stop at four you just don't have enough imagination.
The man saw the woman on the hill by the telescope.
This doesn't fix all the ambiguity but it should have cut the amount down.
What resolves most of the ambiguity in our language isn't grammar. It's the realization that the other interpretations are silly.
Let's try playing with context. In certain contexts what seemed a ridiculous way to take something suddenly seems plausible.
Sam watches a movie with a character named John. Sam sees John is the same age as he is and is suffering from an uncaring world the same as he is. Sam identifies with John. John struggles against his plight but fails. John runs out into the rain filled night screaming. John is angry with the world. Sam feels the same. Sam is angry with John.
The rub is that silly is in the eye of the beholder.