Unless you want really high performance networking, you don't need tons of RAM to implement it. ESP32-based MCUs are known to implement Wifi + TCP/IP + TLS [1] on 1-2MB of RAM. This is, of course, without a Linux-compatible kernel.
Much RAM is not needed if most of your code resides on the flash and runs directly from there.
You can run IP based networking on machines with well under 1MB (smallest I've personally a basic graphical web browser on would have been a 512KB Amiga)
on NXP K60 with FreeRTOS and lwIP IP based networking runs without problems with 256k Flash and 64k RAM. Of course it depends on the application, because the throughput is not high, but that is not the point here