I believe the answer is:
Coastal snakes can detect odor molecules produced by banana slugs.
Coastal snakes have a genetically acquired taste for banana slugs.
Since there is no indication of external treatment that being done to the snakes, this behaviour could only be explained by genetical factors. So, it would be either the snakes have a physical structure that can detect the slugs, or it has a cetain hormonal composition that make it attracted to the taste of banana slugs.