At the risk of being called a SNOB, you need to do some homework before investing in individual stocks. Just Buy Vanguard Total stock market index fund and learn how the markets work. This Fund has the lowest expense ratio.
Actually, you cannot get the dividend, in effect, by purchasing before the ex date because the stock price declines by the amount of the dividend on the ex date so even though you will get credited the dividend a few weeks later you lost the same amount in the price of the stock on the ex date. However if you hold the stock for exactly one quarter you will get the dividend due to the likely run up between ex dates in which case it does not matter when you buy.
In an ideal world the stock wil run up by the amount of the dividend every 3 months between ex dates and will almost cancel out the decline of the stock price on the ex date. So one could argue that you could buy after the ex date, sell before the next ex date, and thus capture the run up between dates which should be almost equal to the dividend.
You can play it either way and the result will be the same. There will be no tax difference because dividends from mREITs are treated the same as short term capital gains. All in all it is a wash. No difference.
My point being is that it does not matter when you buy. There are no tricks that one can use to make greater profits that have not already been arbitrated out by others long before you were born.
That said there was an interesting options play that some were performing here that was working about a year or so ago and worked for several years and it took advantage of the fact that due to AGNC's low volatility at the time that options were dirt cheap and if one timed it well one could make excellent profits on call options between ex dates, so long you sold them before the ex date. But the volatility is no longer low and thus the options are now expensive, relatively speaking, so I suspect that no one has made a lot of money this way for at least 6 to 9 months, give or take.