I can't buy fractional shares, only integers. But I get some shares from my company as compensation and those are fractional all the time (like 1.7 shares). Also, when dividends are automatically reinvested, same thing - fractional shares.

Why is this? Why isn't fractional trading allowed and why is it possible when dividends are re-invested or when my company pays me?