You just need to create one product attributes called, product_mass. Set Different options for those attributes. like, 250mg, 500mg etc..
Stores -> Attributes -> Product
Set those Attribute Scope as Global, and Assigned to attribute set.
Create new configurable product from,
Catalog -> Products,
Click on Right side Button Arrow after Add Products and choose Configurable product,
Now On Create configuration section from edit product page,
Select your attribute called product_mass,
Set Option from list of attributes options,
Now at 3rd step, you just need to select price section and click the Apply unique prices by attribute to each SKU and set different price for each sku.
... View more