it depends on the size and popularity of the specific store. In my city, they don't care if you are there all day, but when you get to the busier and smaller locations, they start to lose money because of people sitting around.
In my experience cafes are usually happy for you to stay for hours if they are quiet. I've never tried in a busy cafe, because spending hours in a busy cafe doesn't appeal to me.