The former is known as paramagnetism and the later is known as diamagnetism. The observed magnetic moment is derived by the change in weight. This observed magnetic moment arises from a combination of the orbital and spin moments of the electrons in the sample with the spin component being the most important source of the magnetic moment. This magnetic moment is caused by the spinning of an electron around an axis acting like a tiny magnet. This spinning of the magnet results in the magnetic moment.
Paramagnetism results from the permanent magnetic moment of the atom.
These permanent magnetic moments arise from the presence of unpaired electrons. When in the absence of an external magnetic field, these spins tend to orient themselves randomly accordingly to statistics. When they are placed in the presence of an external magnetic field, the moments tend to align in directions anti parallel and parallel to the magnetic field. According to statistics, more electrons will occupy the lower energy state then the higher energy state. In the presence of a magnetic field, the lower energy state is the state when the magnetic moments are aligned parallel to the external field.