If a company's shares are listed on an exchange (NYSE or NASDAQ) is it allowed to trade them privately (i.e. one owner to another), without the trade being registered on the exchange?
Yes shares can be traded outside of an exchange, but a transfer agent is still involved.
As stock shares represent various rights and privileges, like voting rights and dividends, someone needs to keep track of who owns what shares. While it can be done within the issuing company, handling ownership & proxy voting is usual outsourced to a stock transfer company like Computershare or AST.
With those transfer agents the owner would either have a book only entry or a ledger entry with physical shares in their possession. Realize that physical shares was not uncommon as it is today in order to avoid the high brokerage fees prior to the 1990s.
In the US if you are holding the shares directly (book or physical), a Medallion Signature Guarantee is required for transfer. Should you have physical shares, the seller/buyer would submit those shares to the transfer agent along with the required tax information of the new owner.
As to the share price of the transaction that would be private matter between the two parties unless other fiduciary concerns are imposed. Note that while the transfer agent may not care that a $200 a share stock was transferred for $1 per share, the IRS might.
So while the exchange isn't involved, some entity like the transfer agent needs to be so that proper ownership of shares is recorded and that proxy voting material and dividends are assigned.
Yes shares can be traded outside of an exchange
NASDAQ was not actually an exchange until 2006. Many platforms (for regulatory purposes) called ECNs (Electronic Communication Networks) were used in a similar way as exchanges to match buyers and sellers. These continue today, and many ECNs and dark pools operate to allow transactions to occur off-exchange. These all require the transactions to be reported to the Transaction Reporting Facility (TRF). It is possible when you do a trade with your broker, it may be executed through other means than one of the three big name exchanges (NYSE, NASDAQ, or CBOE and their subsidiaries). The main rule is that the transaction has to be booked with the TRF within a certain time period and the execution price has to be at or inside the NBBO - national best bid or offer. The TRF reports market data like the exchanges do.
As for trading between two individuals, you may be able to transfer them through the transfer agent, or have your broker transfer them to their broker when you have receive payment (though some brokers may not be willing to transfer the securities to an account that is not in your name). I would also be wary of trading the shares at a price outside of the NBBO.