Weight is a measure of the force of gravity on an object, which depends on the object's mass (which is fixed since it describes the amount of matter in an object), the mass of the closest body exerting the gravitational force on it (the Earth or moon, in this case), and the distance of the smaller object from the center of the planet or moon.
Earth is far more massive than the moon, so the gravitational force that it exerts on Sample B is greater than the gravitational force that the moon exerts on Sample A. So if you want to be technical, Sample B weighs more than Sample A, even though both samples have exactly the same mass and would have the same weight if they were on the same planet/moon.