For the most part there are no legalities that prohibit it. Perhaps some totalitarian countries might restrict their people's air travel buying ability visa the internet (thinking North Korea), but developed nations do not.
Our tour company's primary air ticketing partner is based in the USA, but our clients come from all over the globe. They have arranged all sorts of flights for our guests, intra-Asia flights for folks from the Australia, Australia to Hawaii flights for guests in UK, US to Canada flights from folks from NZ, etc.
That said, there could be fare offerings that are available for sale only within a specific zone or country. In these cases you may need to purchase that fare from an agent or OTA within that country (and sometimes have a billing address within that area as well).
There could also be restrictions on foreign card usage on at a specific OTA or airline website. Though this is usually only effects folks living in countries where credit card fraud is rampant.