Bill's answer is a good, but I'd like to add something specifically regarding the following part of your question:
"It seems paying dividends would only raise the price of the stock, what does a company gain by raising it? Would it make more sense to lower it and buy that back?"
I'd like to point out that the directors of a corporation owe a fiduciary duty to the shareholders of the corporation. That is, directors must generally direct the business of the corporation in a manner that is in the best interests of shareholders – all shareholders, and not some to the detriment of others.
So in theory it would benefit some shareholders for a corporation to temporarily depress its stock price to institute a buyback, but in practice if directors deliberately engineered a depressed price on purpose to buy back some of the shares, they would be in violation of the duty of care owed to all shareholders.
In reality, there are times when a corporation finds itself with a depressed stock price due to market conditions, and in those cases you do find enlightened directors instituting share buybacks. That's perfectly legal.
(BTW, here's a paper I found on the OECD web site that discusses the fiduciary duties that directors have towards shareholders: The Principal Fiduciary Duties of Boards of Directors [PDF].)