Comment by yorwba
The other sound ȝ was used for in words now written with 'gh' like 'laugh' and 'night' corresponds to 'ch' in Dutch/German 'lachen' and 'nacht'. If ȝ had corresponded to a single sound in Middle English, it's implausible that it would've split into two different sounds in exactly the same way as in other Germanic languages. So it's more likely that the two sets of words had always been pronounced with different sounds even in Proto-Germanic, and Middle English scribes merely didn't consider it important enough to distinguish them in writing.