Low-Effort Basic-Bricks $50 Start
Buy the World Fun and Ocean's Bottom sets:
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 police officers from a Town or City set can be turned into a medieval town guard by giving them 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 3-in-1 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. The sets rotate every year, so check my latest Set Recommendations page.
There is usually a creature builder 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) 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. You can then use them to make modular terrain pieces.
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.