1. Prefer + infinitive (refers to choice)
For example we have tea and coffee and you say:
I prefer to drink tea.
2. Prefer + gerund (refers to enjoyment) Gerund is based on experience (habitual):
I prefer drinking tea
"Prefer" used this way behave like "like":
I like to drink tea
I like drinking tea. (habitual)