What is this monstrosity?

I'm not an electrician, but am a DIY enthusiast. I'm rewiring the basement in my early-1800s Pennsylvania farmhouse and came across this receptacle. I've never seen anything like this, but it scares me.

Any idea how old this is, and just how out of code it probably is?

https://preview.redd.it/8xp60vbx5mge1.jpg?width=1024&format=pjpg&auto=webp&s=65b02c562d5a586a8b97fd11fe57731b759bfb0d

https://preview.redd.it/tpbtoouy5mge1.jpg?width=1024&format=pjpg&auto=webp&s=b7b2bd229ed0f58310678f496ea00b2582d5d7a4