Tom does not have the book, like Sam.
The sentence is ambiguous, strictly speaking.
That is spoken English: It is not formal written English. It's how people express the idea of one person having something and another person not having something.
Tom does not have the book like Sam does.
It means that Tom does not have the book, and Sam does have it.
Or It means Tom does not have the book and neither does Sam.
Only the context will tell you.
Like [some person] is used as a comparison in spoken English. It is often used with the determiner a, when a thing is non-specific.
He doesn't have a car, like you. [you have a car: probable, but it can also mean: he doesn't have a car like you don't have one.]
He has a car, like you. [he has one and so do you.]
The comma can be used or not. It depends on how the author (for, say, a script or dialoque in a novel) wishes to emphasize something. It doesn't change the meaning. It can be used or not.
But beware of this: If you say: Like Sam, Tom does not have the book, in initial position, you change the meaning entirely.
1) - You don't have a pool at your house, like me. [like I do; I have a pool].
2) - Like me, you don't have a pool at your house. [neither of us have pools].
The meanings only make sense in a particular context.