No, it's not illegal to sit at McDonalds without buying anything, but it IS illegal to remain on their property after being asked to leave because you didn't buy anything. It's called criminal trespass and is generally a misdemeanor.