No worries, sometimes it’s quite easy to mix something up. Especially when the arguments have the same name. 
Well, the weights in the loss function perform a class weighting, i.e. samples get multiplied with the respective class weight. Have a look at the formula in the docs 45.
The WeightedRandomSampler draws samples according the the weights, so that some classes are sampled more often than others.
In the case of an imbalanced setup, you could try either of these approaches.