How oysters went from cheap snack to luxury dish

Oysters are a sign of decadence. But two hundred years and they were handed out as free bar snacks. So what made them the luxury food they are today?