If a person buys a stock that pays a dividend on or after the ex-dividend date, where we understand “ex” to mean “after,” it means that the buyer would be buying the shares for the amount that still has a dividend (or some of it) priced-in, but the seller, not the buyer, will get to have the dividend, and the share price will go down immediately after the dividend is paid.
Stock prices will tend to go up in anticipation of a dividend, and more so after the declaration date, which might be anywhere from two months to two weeks before the actual dividend is paid, when the company announces when a dividend is to be paid and how much it will be.
When the ex-dividend date comes, it means that it is too late to receive the next dividend payment, but often it happens that the price does not decrease by the full amount of the dividend on that day. If a broker knows that the ex-dividend date is approaching or has arrived, he or she is obligated to inform a client about the potential loss and tax implications they can incur by buying at that time.
If a seller dumps shares on or after the ex-dividend date but before the dividend has been paid, he or she will still receive the dividend if they owned the stock at close the day before the ex-dividend date. The buyer’s market price may not be ideal if the dividend that they do not receive goes to the person who already sold the share.
Even if you are in the seller’s position in this situation, and are seeking to “capture” the dividend, you have to consider taxes, because dividends are usually be x, and, if the stock was not held for over year, short-term capital gains taxes at income-tax rates will also apply to any gains there.