What is the mechanism for this reaction?
In your question, you have mentioned:

The closest reaction I can find is Lossen rearrangement but in that hydroxyamic acid is first converted to its derivative but how will that be possible here?

You have recognized the reaction correctly but the Lossen rearrangement is the conversion of a hydroxamate ester to an isocyanate (only the first step of given mechanism). Although the original Lossen rearrangement needed hydroxamate ester $\left(\ce{R(C=O)NH-O(C=O)R'}\right)$ to rearrange,  recent research has shown that the rearrangement is possible with free hydroxamic acids $\left(\ce{R(C=O)NH-OH}\right)$ as well (Ref.1):

Without using activating agents, a variety of free aromatichydroxamic acids could be rearranged to aromatic amines in the presence of base alone:


Source of the image: Ref.1
According to $\bf{(a)}$, free aromatichydroxamic acid $\left(\bf{1}; \ce{R(C=O)NH-OH}\right)$ react with a base to give  the corresponding carboxylate $\left(\ce{R(C=O)-O-}\right)$ as intermediate and hydroxyamine $\left(\ce{NH2-OH}\right)$ byproduct. The intermediate $\left(\ce{R(C=O)-O-}\right)$ reacts with another aromatichydroxamic acid $(\bf{1})$ to give necessary hydroxamate ester $\bf{A}$, which undergoes Lossen rearrangement in basic conditions to give the isocyanate $\bf{B}$. Mechanism for aromatic amine from isocyanate is depicted in $\bf{(b)}$.
For instance, the base-mediated rearrangement of free 4-methylphenylhydroxamic acid $\bf{(1a)}$ to  4-methylaniline $\bf{(2a)}$ is given as follows:

A mixture of N-hydroxy-4-methylbenzamide $\bf{(1a)}$ $(\pu{0.363 g}, \  \pu{2.4 mmol}),$ $\ce{K2CO3}$ $(\pu{0.332 g},$  $\pu{2.4 mmol})$, and DMSO $(\pu{2 mL})$ was heated to $\pu{90 ^\circ C}$ and stirred at that temperature for $\pu{2 h}$. The mixture was cooled to rt, and then treated with $\pu{2 M} \ \ce{ HCl}$ $(ca. \pu{3 mL})$. After the mixture became the clear solution, $\pu{2 M} \ \ce{NaOH}$ $(ca. \pu{3 mL})$ was added and extracted with $\ce{Et2O}$ $(\pu{15 mL} \times 3)$. The combined organic layers were dried over anhydrous $\ce{Na2SO4}$, filtered and evaporated under reduced pressure. The residue was purified by silica gel column chromatography $(\ce{hexane/Et2O}, 1:1)$ to yield the pure 4-methylaniline $(\pu{0.253 g}, \ 98\%)$ as a white crystalline solid.

The effects of the amount of base, reaction time, and presence of water are summarized in following diagram (Ref.1):

Thus, as shown in above diagram, presence of water may have direct effect on the conversion of the substrate to corresponding amine (even in DMSO). Further, Ref.1 clearly shows that this reaction requires polar aprotic solvent to proceed through Lossen rearrangement to give thiocyanate intermediate, which eventually converted to corresponding amine in the presence of aqueous base. For instance, if $\bf{(1a)}$ is reacted with $\ce{K2CO3}$ in methanol instead of in DMSO or DMF at for $\pu{90 ^\circ C}$ for $\pu{2 h}$, the yield was found to be only $10\%$ while it was $98\%$ in DMSO and $92\%$ in DMF under the same conditions. The authors reported $86\%$ of the starting compound has been recovered unreacted (none of it recovered in DMSO or DMF).
Note that the first reaction given in the question is in aqueous medium. Thus, according to the results found in Ref.1, the resulting product in the given reaction would be a trace of corresponding amine $\left(\ce{R-NH2}\right)$ and most of substrate would be recovered unreacted. Consequently, there won't be a reactive isocyanate $\left(\ce{R-N=C=O}\right)$, thus the reaction would not proceed to give the anticipated product in methanol as indicated.
Suppose this first reaction has been done in $\ce{OH-/DMSO}$ in place of $\ce{OH-/H2O}$. That would give you the anticipated isocyanate intermediate $\left(\ce{R-N=C=O}\right)$. It is well known that isocyanates reacts very differently in the presence of water, alcohol, and amine. In the presence of water, it would give you corresponding amine with evolution of $\ce{CO2}$. However, in the presence of alcohol or amine, it would give you corresponding carbamate or urea derivative, respectively$:

Since the given second reaction is in methanol (an alcohol), the product would be a methyl carbamate as shown in the scheme above (Ref.2). For example, polyurethane is prepared from diisocyantes:


References:

Yujiro Hoshino, Moriaki Okuno, Eri Kawamura, Kiyoshi Hondab and Seiichi Inoue, &quot;Base-mediated rearrangement of free aromatichydroxamic acids (ArCO–NHOH) to anilines,&quot; Chem. Commun. 2009, (17), 2281-2283 (DOI: https://doi.org/10.1039/B822806J).
Greet Raspoet, Minh Tho Nguyen, Michelle McGarraghy, and Anthony Frank Hegarty, &quot;The Alcoholysis Reaction of Isocyanates Giving Urethanes:  Evidence for a Multimolecular Mechanism,&quot; J. Org. Chem. 1998, 63(20), 6878–6885 (DOI: https://doi.org/10.1021/jo9806411).