Why the charge of the proton does not transfer to the neutron in the nuclei?

A proton can exchange charge with the neutron via a process called "pion exchange". In this process, the proton with quark content $uud$ sends a positive pion $u\bar{d}$ over to the neutron $udd$. The antidown annihilates one down quark in the neutron and adds an up quark, turning the neutron into $uud$, a proton. But what happened to the proton? By sending one of its up quarks and creating a down-antidown pair, it's left with $udd$; it's now a neutron.

So even though they swap charge, you're always left with a proton and a neutron at the end of the exchange.

If I put a red billiard ball and a blue billiard ball in a bag, leave them for a while, and then draw one out, I will find I am holding a red ball or a blue ball. Never a purple ball.

At the level of fundamental particles, we know from experimental evidence that electric charge is a discrete quantity and behaves like the colour on the billiard balls, not like a continuous quantity such as temperature. This is shown in experiments such as Millikan's oil drop experiment. Why ? That’s just the way the world works.

Good question!

First, the motion of charge between macroscopic objects is defined by classical physics, specifically classical electrodynamics or classical Maxwell's equations to be specific. Nature likes to reach a state of equal charge, but in the microscopic world, things are very different.

And an important point to be made, is that your question assumes that nucleons are constantly “in contact” inside the nucleus. As explained below, nucleons are quantum mechanical objects and as such are described by wave functions. This means that their “location” is described by a probability wave. So in reality they are not actually in contact, and their “location” takes on a more complicated description. And also because of this, nucleons do not have well defined volumes or surface areas, and so them being in contact is still not a defined concept. And, also described below, at the quantum level, charge is discrete. It is quantised and not continuous, which seems to be what your question implies.

The behaviour of protons and neutrons (nucleons) is described by the strong nuclear force which itself is described by the standard model (using the mathematical formulation of quantum field theory) and so we should not use a classical approach or description to describe such things.

Now according to the strong nuclear force and the standard model, nucleons are composed of elementary particles called quarks, meaning that nucleons are actually particle states containing these quarks.

The proton is composed of 2 "up quarks" and one "down quark" where the up quark has a charge of $+\frac{2}{3}e$. The down quark has a charge of $-\frac{1}{3}e$. This is why a proton has a charge of $+1e$ and a neutron has a charge of $0$ since it is composed of two down quarks and one up quark. It is electrically neutral as you have stated. And you cannot get these fractional charged particles on their own. They exist in bound states. See this article on quark (or color) confinement. Quarks exist only in bound states with two or more or them, and trying to separate them will result in the creation of another quark.

But does the proton transfer charge to the neutron at all?

During a process called pion exchange, a proton exchanges a pion (which is composed of a quark-antiquark pair) with a neutron, which actually changes the neutron into a proton, and the original proton becomes a neutron. We can imagine this constantly happening inside the nucleus - not exactly a 50-50 sharing of charge, but interesting and relevant, nonetheless.

To summarise, the motion of charge between macroscopic objects in the classical world is not analogous to that in the microscopic quantum world, and charge is quantised and these quantised objects (quarks) form compound particles, such as protons and neutrons (there are four more other quarks - that we know of - and all the quarks can combine to form other massive, even more exotic particles, and not just protons and neutrons). These particles are all described by wave functions and quantum fields, such that their location is described by a probability distribution. They also have no well defined shape either, for them to be in “contact”. And finally, charge does not "flow" from one quantum particle to another as if it’s continuous. Rather, it is quantised. So it is not possible that they can share charge in a “half-half” fashion as you described.

But there are quantum mechanical processes where particles with quark content (and therefore charge) can be exchanged between the proton and neutron.