Cheese contains less Lactose than milk.
So if you're Lactose Intolerant your stomach could hurt but you can eat cheese without an issue because it contains less Lactose than the milk which doesn't cause issues with your stomach.
Some people can be Lactose intolerant and still consume cheese but not milk.
My brother who is lactose intolerant cannot drink milk without it hurting his stomach but he can eat cheese, yogurt and even ice cream without issues.
But the milk it hurts his stomach so he cannot drink it.
Well he does drink just a little bit of the milk because he likes milk with cookies or just some milk but he drinks very little.