Here are a few quick resources.
https://developer.ibm.com/articles/l-initrd/
https://docs.kernel.org/admin-guide/initrd.html
https://en.wikipedia.org/wiki/Initial_ramdisk
That answers the question "how would it be set up?"
For the question "what is the purpose of it?" maybe you don't need more of an explanation, but I'll take a stab at it anyway -
Linux used to not need an initial ramdisk. (Technically you can still boot without one.) So it's interesting to think about what happens immediately after the kernel is done and has handed off control to the first process, typically named "init" but really it's whatever the kernel has been given.
Side note: if the kernel doesn't have an initial ramdisk, it'll load "/sbin/init" from the root device.
That is why an initial ramdisk came into being. If the root device is a USB flash drive, it may not have shown up yet. USB flash drives can take a looong time to become ready. There is the "rootwait"
parameter which just has the kernel hang silently forever for the root to be ready.
The initial ramdisk wasn't common at first, but PXE boot, bootable USB drives, iSCSI and SAN were some places where an initial ramdisk were very much needed.
The initial ramdisk means that instead of specifying a root device (/dev/sda or something) the kernel can hand off control to code which can do whatever you want in terms of finding the root drive, or mounting a bunch of things before running /sbin/init, or whatever you need.
Typically the initial ramdisk will load kernel modules needed to get to a working system. As linux distros started including more and more modules, they adopted the initial ramdisk and it became commonly used.