Pylons in Terraria allow you to set up a teleportation system for quick and easy fast travel around your world. They can be sold by NPCs, and the NPCs will sell Pylons relative to the biome that they are living in.
- CavernDesertForestHallowJungleMushroomOceanSnowUniversal
You can only buy a Pylon from an NPC who is happy. To make them happy they need a home, some friendly neighbors, and they will all have different Biomes that they prefer to live in. As an example, according to Redditor Nick_Smith11, he has discovered that having both the Arms Dealers and the Nurse living in the Ocean biome will result in the Arms Dealer selling you the Ocean pylon.
It should be noted that any NPC can sell the pylon for the biome that they are in, it will just be much easier to make some NPCs happier in specific biomes that they like living in. To check which biomes an NPC prefers, you can check their Bestiary entry.
Because of the fact that the 1.4 update has just released, the exact way this all plays out is still a bit mysterious. Many players seem to be reporting different results for which NPCs prefer which biomes, so this could be general confusion, or it could be world-dependant. It is a good idea to check your own Bestiary rather than rely on online information.
Remember, each NPC in a biome will need their own house, so make sure you build everyone a home to add to their happiness.