A trade takes a few days to clear. In order to be the "owner of record " on a certain date you have to have purchased it at least a few days before. That is the day before the x dividend date.
Why anyone would want to "BUY " a dividend is beyond me. You can buy a few more shares today and it makes even more sense in a taxable account.