Welcome to the SDMB!
Ants definitely do not make up a quarter of the earth’s mass (better use mass than weight: weight is the force that earth exerts on a certain amount of mass, but what force does earth exert on earth?). Consider the fact that the earth is a sphere. If the mass were evenly distributed, you would have to dig from the surface towards the center all around the globe as far as 10% of the earth’s radius (or about 636 km) in order to collect 25% of its mass. Given the fact that earth’s matter is much more dense at its center that within the outer 10% of the radius, you would have to dig even farther.
Anyway, digging 10% of the radius would catch all the ants, but they would still only make for a small part of the dug material. This shows that their combined mass is far from 25% of the earth’s mass.
Probably somebody stated that ants (or insects in general) make up 25% of the earth’s organic matter, which would be something completely different. However, I can neither verify nor falsify this hypothesis.