Basic-Bricks $50 Start
Buy the World Fun and Ocean's Bottom sets:
Generic Brand $50 Start
If you don't mind the slightly lower quality, and you are willing to wait a month for things to get shipped from China, then you can get a lot of value from the generic-brand bricks on Aliexpress. Nothing here is a copy of a real Lego set; they are unique designs. Here is my recommended bundle to get a good mix of monsters, terrain, and 13 minis (I have ordered all of these sets from these exact sellers):
1) Four Dragon Riders. Each one of these has as many parts as a Mixel; you can use them to make a nice variety of monsters.
2) Enlighten Archery Range, Ent Witchclaw, Blacksmith Shop, and maybe something else of your choice from the Enlighten store. These give elves and dwarves, as well as enough bricks to make dungeon rooms and natural areas.
1) Get a Fantasy Minifigure Set:
You will get a good collection of people and accessories, and even a few bits of terrain, for about $55. Let your players make their PCs by mixing and matching whatever parts they want from the people there, and then use the rest to make NPCs and humanoid enemies.
2) Get the latest Creator 3-in-1 creature-building set (currently Fire Dragon). The sets rotate every year, but they usually have something good for $20 or less. Assemble one of them, have the players disassemble it in-game, and then make the next one for the next session. Then use the parts to build your own monsters.
3) If one is available that looks appropriate for the campaign, get a Creator 3-in-1 building set like Outback Cabin. If you can't find anything appropriate, or if you are confident in your building skills, get a basic box of bricks like Classic Creative Supplement and use it to make modular terrain pieces.
4) Get a couple little sets from whichever theme best fits your campaign style. Suggestions are on my latest set recommendations page.
If you want to spend more time or money, you have several options.
1) Used Lego
Lego bricks are incredibly durable; 30-year-old ones are almost as good as new. The worst case scenario is that they are dirty or dusty and you have to clean them up.
shopgoodwill.com is a great way to buy Lego. I use it often. The prices are better than ebay, and it is not dominated by expert sellers who pick out all the good stuff from bulk lots. Search for 'Lego pounds' to filter for bulk collections, and bid on something that looks good. You will almost always win if if you bid $5 per pound after shipping. Sometimes, the lots that say 'no minifigures' will actually have disassembled minifig pieces that you can assemble into people; look for disassembled legs or heads or torsos in the item picture.
Craigslist is also an option, depending on your area. You might get a very good deal on an ideal used collection, although the usual caveats for dealing with people apply.
You might get lucky and find a lot or collection with (pieces from) Castle, Pirates, Harry Potter, Elves, Vikings, Monster Hunters, Chima, Ninjago, or Lord of the Rings sets. But with a little creativity, you can use any kind of Lego set. Both the Lego space sets and the Star Wars sets have a lot of figures and accessories that work surprisingly well in a D&D game, and a police officer from a Town or City set can be turned into a medieval town guard by giving him a sword.
Serious Lego hobbyists (and people who got five dozen handless legless minifig torsos in a shopgoodwill bulk order) use bricklink.com to buy individual parts they need. If you want hundreds of bricks and plates to make a full dungeon map, with a Lego baseplate floor, get them here.
2) Creator Sets
If you are not able to find a good source of used bricks, or do not want to buy anything used, or have little Lego experience and are not comfortable building things without instructions, the Creator sets are a good value for terrain, settlements, and sometimes monsters. They usually come with instructions for three different things. Following these instructions, and the extra build ideas, will give you experience in working with Lego bricks to make lots of different things.
3) Individual Sets
Individual sets will often give a good mix of interesting new minifigures and weapons, terrain, and/or large monsters. Aim for the ones that have structures, not vehicles, although some vehicles can be remade into large monsters. Again, see my latest set recommendations.
4) Basic bricks
If you are already confident in your ability to use Lego bricks to make lots of things, or you just need a lot of basic bricks to build dungeon wall segments, get the basic Lego brick buckets. They are the best value for the money for buying basic bricks new.
If you live next to a Lego store, you can go in and make three custom minifigs for $10. This can be a good way to fill specific holes in your collection.
6) Random Minifigures
It is my last choice, and probably the least cost-effective way of building up a collection of PCs and NPCs, but the random minifigures often have a lot of very nice things that you cannot get anywhere else. Each series of 12 random figures will typically have about 6 that are really nice for a fantasy setting, 3 or 4 that are marginal, and 2 or 3 that are worthless. At $4 each, with about a 1 in 5 chance of getting something useless, you are basically paying $5 per useful figure.
You might consider buying specific ones on the secondary market, but from what I have seen, the ones you are likely to want for a fantasy RPG game will cost more than $5, so you are better off playing the odds and getting the extra people to be creative with.