Is it better to miss the dividend and buy the undervalued stock?
As yet another explanation of why it does not really matter, you can look at this from the valuation point of view. Stock price is the present value of its future cash flows (be it free cash flow of the firm or dividends, depending on the model). Let's have a look at the dividends case. Imagine, the price of the stock is based on only three dividends streams $5 dollars each: dividend to be paid today, in year 1, and in year 2. Each should be discounted back to today (say, at 10%), except today's dividend, since today is now.  Once that dividend is paid, it is no longer in the stream of cash flows. So if we just delete that first $5 from the formula, the price will adjust itself down by the amount of the dividend to $8.68. NOTE that this is a very simple example, since in reality cash flows streams are arguably infinite and because there are many other factors affecting stock price. But simply for your understanding, this example should provide you with the reason simply from the valuation perspective.