What makes a married man pretend he’s single?

I was reconnecting with a guy friend and we didn’t talk for a few years when he moved away. Long story short he knew I liked him, didn’t feel the same.
He told his friends that I would be a great girlfriend and he wanted to sleep with me (he doesn’t know I know this).

This time he said he was more than happy to be friends and we were talking for a few weeks about our lives etc, he would reply really fast etc, show interest and wanted to know my dating situation BUT when I made a joke about being single he then says he’s married…. I feel stupid for thinking he was single but he gave the impression he was.
To be clear he lives in a whole other country so no chance that anything would happen anyway, but now I feel like I can’t even talk to him any more…why did he pretend to be single and not just mention it earlier when we got a bit flirty? Or maybe I should’ve asked I guess? Can a guy and girl ever be just friends or did he want something from me/ego boost etc?

What makes a married man pretend he’s single?
Post Opinion