Why do restaurants offer you meals “On house”?

I went to this restaurant I frequently passed by it, but never went in it, cause it was quite expensive and people always dressed very nicely in it.

This lunch time I went in and took a couple of photos of myself, I was looking cute,

the guy came and offered me a dessert and coffee on house, I didn’t exactly know the meaning of “On house” and I said “Thank you, but I am about to leave”.

Then I searched on house and guessed it’s free of charge, now I feel like I must have.

I have often being given some free desserts and so on, but I wonder is it the marketing strategy to make you go back?

If so, how do they pick which customers to give free meals?

Why do restaurants offer you meals “On house”?
Post Opinion