In the Kodokan Goshin-jutsu kata, a variation of osoto-gari grabbing uke's neck (as opposed to their collar) is taught as a defence from a punch/strike by uke (naname-uchi):1
One can also perform osoto-gari by grabbing the uke's hair to break their balance backwards:2
Are such grips legal in competition? Though they seem intuitively to be 'against the spirit of judo', the only explicit references in the IJF rules to similar grips is prohibiting touching the face,3 and enforcing that long hair be tied up so as not to inconvenience the opponent.4
1. Mastering Judo, Masao Takahashi (p.55, table 4.3.ii.1.); Kodokan Goshin-jutsu
2. WC Tokyo 2019 | Women | U48 | Bilodid vs. Martinez Abelenda
3. IJF SOR: Article 18.5 - Prohibited Acts and Penalties
To put a hand, arm, foot or leg directly on the opponent’s face. The face means the area within the line bordered by the forehead, the front of the ears and the jawline.
4. IJF SOR: C220.127.116.11 Judogi Control Procedure
Long hair must be tied up out of the way and not prevent the grip of the opponent.