Muscle takes up less space than fat (as others have said, it’s more dense). So, a 150 pound person with relatively low body fat and more lean muscle will be more thin and trim than a person of the same height and weight with a higher percentage of body fat.
That’s how people lose inches but not weight in some cases when they work out.
As Karin pointed out, muscle weighs more when expressed as the same unit of volume. In other words, fill a container with muscle tissue and fill the same-size container with fat tissue – the container with the muscle tissue will weigh more. That’s because muscle tissue is more dense than fat tissue. Hopefully that makes sense to you.