Remark
This is an important question for anyone that shops especially now when inflation is on the rise. The stores in general price things so that big is better, but it isn't always so.
General Formula
You want your units to be in dollars / gram
Cost in dollars / gram = dollars divided by grams.
A
5.67 / 98 = 0.05786
B
7.03 / 127 = 0.0553 dollars per gram.
In this case bigger is better. You pay less for each gram you buy. That's how you know. Less is good.