$$\ce{R-X + AgNO_2 -> RNO_2}$$
Now depending on the $\ce{R}$ and solvent the reaction can occur via $\mathrm{S_N1}$ or $\mathrm{S_N2}$.
When the reaction proceeds via $\mathrm{S_N1}$ the product formed is $\ce{R-O-N=O}$ whereas for $\mathrm{S_N2}$ it is $\ce{R-NO_2}$.
Why is this so? According to me as the $\ce{Ag-O}$ bond is covalent the lone pairs on nitrogen must attack in both the cases forming the product $\ce{R-NO_2}$.

2 Answers
2

The concept of hard and soft acids and bases (HSAB) proved to be
useful for rationalizing stability constants of metal complexes. Its application
to organic reactions, particularly ambident reactivity, has led
to exotic blossoms. By attempting to rationalize all the observed
regioselectivities by favorable soft–soft and hard–hard as well as
unfavorable hard–soft interactions, older treatments of ambident
reactivity, which correctly differentiated between thermodynamic and
kinetic control as well as between different coordination states of ionic
substrates, have been replaced. By ignoring conflicting experimental
results and even referring to untraceable experimental data, the HSAB
treatment of ambident reactivity has gained undeserved popularity. In
this Review we demonstrate that the HSAB as well as the related
Klopman–Salem model do not even correctly predict the behavior of
the prototypes of ambident nucleophiles and, therefore, are rather
misleading instead of useful guides. An alternative treatment of
ambident reactivity based on Marcus theory will be presented.

Within the review, in the section on the nitrite ion, the authors give two competing effects that control product distribution.

For electrophiles with an electrophilicity parameter $E < -3$ (the bis-(4-methoxyphenyl)carbenium ion has $E = 0$, lower values are more stabilised carbocations such as bis-(4-dimethylaminophenyl)carbenium) the reactions proceed at equilibrium under thermodynamic control and the product yields are equivalent to their relative stabilities. Since nitro compounds are more stable than nitrite esters, they predominate.

$$\ce{R-ONO <=> R+ + NO2- <=>> R-NO2}$$

For electrophiles with a parameter $E > 0$, the reactions are essentially diffusion controlled, i.e. the free electrophile will capture the first nucleophile it can find. This includes tertiary alkyl carbocations ($E \approx 7{-}8$). The reactions do not go through classical transition states, and any means of describing them via frontier orbitals must fail. That explicitly includes describing them according to $\mathrm{S_N1}$ or $\mathrm{S_N2}$. In these reactions, kinetic control determines that the $\ce{O}$-attack is slightly more likely with $k_\ce{O} / k_\ce{N} \approx 3.4$. (This corresponds to computational models that show a slightly smaller activation barrier for the oxygen attack.)

Reality is more complex than these simple models imply especially for the diffusion controlled reaction. While the attack of oxygen is favoured kinetically, the attack of nitrogen results in less required reordering of the molecule (the two $\ce{N-O}$ bonds would still be identical while they become $\ce{O-N=O}$ in the nitrite ester) which reduces the expected favourism for oxygen. Effects such as solvent and counterion slightly affect the product distribution, and the highest ratio of nitromethane : methyl nitrite can be achieved using $\ce{Bu4N+ NO2-}$ and $\ce{MeI}$ in $\ce{CDCl3}$ (a product ratio of $70\,:\,30$ in favour of nitromethane). Note that $\ce{AgNO2}$ and $\ce{MeI}$ in DMSO yield more methyl nitrate ($54\,:\,46$) although the same electrophile is used. The authors conclude the nitrite section with the statement:

It should be noted, however, that the selectivities
shown in [the table presented in the review] are also not related to the hardness of the electrophiles.

Note

Throughout this answer, electrophilicity parameters according to Mayr’s equation are used:

$$\lg k_{20~\mathrm{^\circ C}} = s(E + N)$$

$E$ is a nucleophile-independent electrophilicity parameter while $s$ and $N$ are electrophile-independent nucleophilicity parameters.

$\begingroup$You say that the attack with N would require less re-ordering of the molecule. But how would this be a hindrance to the attack?$\endgroup$
– Tan Yong BoonJan 22 '18 at 23:19

$\begingroup$@TanYongBoon If I can just put two things together, forming a bond is quickly achieved. If upon putting two things together I also need to distort one internally, there’s a slightly higher barrier to be overcome.$\endgroup$
– JanJan 23 '18 at 16:41

Pearson's HSAB theory provides a simple explanation. When the reaction proceeds via $S_N1$, a hard acid (electrophile) is firstly generated (the carbocation) which interacts with the harder part of the nitrite anion an that's the oxygen-hard nucleophile. The $S_N2$ proceeds smoothly for the pair soft nucleophile–soft electophile.

In the given example the soft electrophilic carbon reacts with the soft center of the nitrite anion, and that's the nitrogen atom. In the former case, the silver coordinated to the oxygen definitely weakens its nucleophilicity. The formed carbocation has to be pretty hard and not so much stabilized by the solvent for the O-attack to be operative.