Building your own PC will almost always be cheaper. Companies that are selling prebuilt machines are often paying the same price as you would for parts, but charging for build labor. There are times where a particular prebuilt machine is sponsored by some PC parts brands and able to be sold for less than you could get it for. You could always look up prebuilts and then search for each part and see what price you could get it for. Wouldn't hurt to cheap out on the case and peripherals if you're on a tight budget.
And yes, GPU's and RAM are both very expensive right now. Cryptocurrency miners are driving the prices of GPU's through the roof, while flash memory in general has been on the rise lately. As much as I hate to say it, you may want to look for RAM on eBay to get the best price. I would avoid doing this with GPU's, however, considering you may end up with someone who wore theirs out from mining.