Welcome to the Site IsaacZ.
The IPO price is set between the underwriters and the specialist in the NASDAQ. There are a lot of complexities on how to get to this price, everyone is trying to pull to their own side. In the Facebook example, the price was $38 for all IPO participants. Then, once the IPO went to the secondary market, the bid/ask drove the pricing.
At the secondary market the price is driven by the demand and offer of the stock. That is, people who wanted to buy right after the IPO likely drove the initial price up.