I do not agree with some details of the above answer.
The first observation is that "nothing" is not a "name".
The logical form of :
"Nothing is better than butter"
"for all x, not (x is better than butter)"
where "nothing" has been analyzed in term of quantifier and variable (a variable is "grammatically" a pronoun).
If we stay with this analysis, we can correctly apply the transitivity of the relation :
"_ is better than ..."
i.e. : if "x is better than y" and "y is better than z", then "x is better than z".
But from "Nothing is better than butter" we can infer "cheese is not better than butter" and also "margarine is not better than butter".
But in this way, we cannot conclude nothing about the "relative position" of margarine and cheese.
The second observation regards the fallacious analysis of
"Margarine is better than nothing"
in term of the the relation "_ is better than ...".
In this case the locution "is better than nothing" must be understood in "adjectival" way, like "is acceptable" or "is tolerable".
Thus, we cannot symbolize it as :
"Margarine is better than x".
Try with the quantifiers.
Clearly it is not "exists x (margarine is better than x)"; we are not saying that there is some food which is worst than margarine.
But also "not exists x (margarine is better than x)", i.e. "for all x not (margarine is better than x)", which means that margarine is (one of) the worst food.
Of course, the conclusion is the same : the "purported" syllogism does not conclude !