Using commas around names that specify relationship
In your second example, putting 'Sam' between commas makes it an appositive. An appositive is an extra descriptor which is used to give more information about the noun next to it, but doesn't add anything to the sentence. In fact, you can remove the appositive without affecting the meaning of the sentence. So your second example has the same meaning as "My brother loves to eat cake.", while also indicating that your brother's name is Sam. To me this implies that in your current situation there is only one person whom you would refer to as your brother. Maybe you have multiple brothers, but only one is at the party with the cake.
In your first example, 'My brother' is being used like an adjective to describe Sam. This sentence does not imply anything about whether you have other brothers. It could be used if your brother and friend, both named Sam, were eating the cake, and you wanted to express which Sam loved it. Or it could be used to indicate that the Sam you are talking about is your brother.
In the last example, you again use 'Sam' as an appositive, so the sentence is equivalent to "One of my brothers loves to eat cake", while at the same time specifying which one. This sentence does imply that you have other brothers.