Every dividend is payable on a fixed date to all shareholders recorded on the books of the company as of a previous date of record. For example, a dividend may be declared as payable to holders of record on the books of the company on a given Friday. Since three business days are allowed for delivery of stock in a "regular way" transaction on the New York Stock Exchange, the Exchange would declare the stock "ex-dividend" as of the opening of the market on the preceding Wednesday. That means anyone who bought it on and after Wednesday would not be entitled to that dividend.
If you buy a stock before it goes X-dividend, you can expect to pay a higher price than if you bought it on the X-dividend date without the dividend. The difference in price may be more or less than the amount of the dividend. The disadvantage of buying before the stock goes x-dividend is that the dividend is taxable. Reits don't qualify for the lower tax rate. To the extend the dividend is from income, you pay the full tax. If you bought the stock without the dividend at the lower price, the savings would not be taxable but you would have a lower tax basis.