Question: why are grams and milliliters?
Answer: They are related by density which specifies mass per volume. Every material has a density value, The exception I mentioned is pure water which is defined as having a density of one gram per ml. Thus, the number of grams of pure water is always the number of ml of water.