There are lungs and there are gills. There are some other ways to get oxygen as well. Some animals respire through the skin. Behold: the Hairy frog.
These frogs do gas exchange through their well vascularized dermal papillae.
For an example of a mammal with gills, one could consider Heuvelman's cryptid merhorse.
from In the Wake of the Sea-Serpents.
The merhorse: an elongated sea animal of large size characterized by a
sort of large mane hanging down it's neck.
It is it may seem surprising that there should be a semi-abyssal
mammal living at a fairly considerable death of up to 100 fathoms. It
is here that their mane, so very unusual in a sea animal, make come
in. It is noticeable that the better adapted an animal is to life in
the sea, the more hairless it is; the cetaceans are smoother than the
pinnipeds and even in the fur seal the mane is very short. Ivan
Sanderson has suggested to me that the mane of these sea serpents
might be respiratory organs in the form of filaments, , similar to the
hairs of the hairy frog similar to the hairs of the "hairy frog", and
supplementing their pulmonary respiration. And in the merhorse as in
the hairy frog these hairs are reddish which may perhaps be due to
their structure and function. But, admittedly, this arrangement would
be quite unique among mammals.
Of course the merhorse is a theoretical cryptid. But the rationale of a vascularized "mane" of dermal appendages makes sense. The animal (the merhorse is a mammal; possibly a pinniped) spends a great deal of time at depth (as evidenced by its huge eyes). If it could do some gas exchange at depth through vascularized skin, that would let it stay down longer before resurfacing. It could hunt, or hide, or do whatever it needed to do in its deep home.
Some pinnipeds do have very vascular secondary sex organs akin to rooster combs - here is a hooded seal showing off his.
If the merhorse gained greater fitness by increasing the size of its respiratory skin appendages, they could increase and proliferate until they formed a manelike covering. It is not a gill in the fish sense, but it has converged on the function of an external gill like that of a worm or an axolotl.
I think a very big animal would probably derive little selective benefit from slightly more gas exchange area. Probably this would first arise in a small seal. Once the vascular mane was established as helpful to a small animal, it could be selected for larger sizes, culminating in the large merhorse.