Maybe start with ammonia acting as a nucleophile, rather than a base, so you form the hemi-aminal, which then collapses to the amido-alcohol. Whilst amides aren't that basic, the fact you form a 5-membered ring if you then nucleophilically attack the carbon with the alcohol and condense out water may be enough to entropically drive the reaction, but I'm not 100% sure