Stock price is dependent on the average trade price, so technically you could just drive up a stock if you had limitless funds.
But the fun stuff is market cap (the "value") of a company only takes the current price into account, because how else could it work?
So recent trades drive up the value of a stock that most people bought when it was cheaper, doesn't mean a billion or trillion or whatever dollars went into it recently. Only means there are more buyers than sellers and the price has gone up.
It also means that you can't actually sell the entire company worth of stock and get the value listed as its market cap. There wouldn't be demand for it and it would plummet hard.