The statement above is false. The statement should be: "Gravity is a force of attraction between objects that is due to their masses." Mass and weight are often interchanged. Gravitational force depends on the masses of objects, but the size of this force is what weight is. So the relationship is:
Weight = mass x gravitational constant = mass x 9.81 m/s^2