The gram is a unit of mass, so "10 grams" has "grams" as the unit. "10 pounds" uses a different unit.
So what is the "salt" in "10 grams of salt", if not a unit? In other words, what is the difference between "10 grams of salt" and "10 grams of sugar", if the units are the same but they refer to different entities?
Simply put, the answer is "No.", but there are different viewpoints that are equally viable:
You can take "grams of salt" as the unit, of which you can have $10$.
You can further take "GramsOf" as a function such that "GramsOf(X)" is the unit.
You can take "$10$ grams of" like a function, which when applied to "salt" gives 10 grams of it.
You can further take "$10$ grams of" to mean "$10$ times of a gram of".
In both cases there is an action of some kind of quantities on some kind of amounts. In the first case we have the action of real numbers (like $10$) on definite physical entities (like "gram of salt"). In the second case we have the action of quantifying functions (like "10 grams of") on indefinite physical entities (like "salt" or "water").
The question of which interpretation is the 'right' one would involve linguistics, but it is certainly an interesting question related to the mathematical notion of action.
I would argue that unless the context indicates otherwise, the second view is the default one. Consider:
Most people would interpret it as "( not even 10 grams of ) salt" rather than "not even 10 ( grams of salt )". Another example:
People are likely to do a double-take when they reach "teaspoons of", because when reading the first part they would automatically parse it as "( 10 grams of ) fructose syrup", which would leave them wondering whether the sentence means "... or 10 teaspoons of sugar". This would not be an issue if they had parsed it as "10 ( grams of fructose syrup )".
These suggest that the second viewpoint is the default one, and probably because parsing is biased towards binding as early as possible, so "10" binds to "grams of" by default (since they can).