This question can basically be analyzed from the standpoint of copyright law, much as in any other topic related to publication.
In your paper, there are clearly some parts to which you hold rights as the author: the text itself, figures that you have created, etc. However, in the version published by the journal there may be certain elements to which you do not hold any right: general presentation, typesetting, etc. Even editorial corrections that have made your text better in some way may be seen as generating rights for the journal. Additional work done on your text may also intervene here, such as correlating citations with existing papers published in electronic form, which helps the reader navigate from citation to citation and thus may be seen as increasing the value of the paper.
Some questions you need to ask yourself are:
- What have you signed? Have you signed or otherwise agreed to transfer some rights to the journal? All rights? Are the rights granted to the journal exclusive rights? Are they limited in time?
- Which is the applicable jurisdiction? All copyright law is not equal. For example, in some jurisdictions an author's granting access to colleagues may be considered "fair use", but this concept may not be applicable or even exist in other jurisdictions.
In certain jurisdictions, the transfer of exclusive and universal rights may be against the law, invalidating the agreement signed by the author at least in part. For example, the right to be mentioned as the author of a text -typical of copyright law- may not be waived in Spain. The author may choose to assert or not such a right, but the journal could not publish the paper anonymously (even in extract form) without the author's explicit approval.
It is worth mentioning that the agreement signed with the journal has been prepared exclusively by the journal, in the form of "general conditions" for the use of a service. This places the author somewhat in a position of inferiority, since he or she has not contributed to the wording of the text. Some jurisdictions will take this into account when interpreting the finer points in the text, often in favor of the author. Since the journal had more time and a better bargaining position to start with, it is up to them to have come up with a fair and balanced agreement that both parties can stand by.
So, while observable facts are as stated by the OP in the question (there may be a potential legal problem, but some authors have no qualms in providing open access to their papers), unfortunately the legal situation is so complex that it would be very difficult to give a single, authoritative, answer.
If you are worried about a specific case, the best guidance to be given would be to consult a lawyer with experience in handling copyright law in your jurisdiction. Your university's legal department may very well have had to handle similar circumstances and have guidelines set up.
Otherwise, it is always wise to remember that there does exist a legal distinction to be made between public communication (making a text available on-line) and private (an email). Editorial companies have a much better case to have public communication halted - in the first place, because they can easily prove it actually happened. I, personally, would not have any difficulty with supplying a colleague with a private (proof) copy of a paper if so requested by email.