Place the ground beef in a bowl and season with salt and black pepper. Divide it into three equal portions and shape each into a thin patty that closely matches the size and shape of the rye bread.
Press a small indentation into the center of each beef patty with your thumb. This helps prevent the patties from puffing up while cooking.
Melt the butter in a large skillet over medium heat. Add the sliced onion and cook for 5–7 minutes, stirring occasionally, until soft and translucent. Transfer the cooked onion to a bowl and set aside.
Place the beef patties in the same skillet. Cook for approximately 3–5 minutes per side, depending on their thickness, until browned and cooked through. For food safety, ground beef should reach an internal temperature of 160°F (71°C).
Transfer the cooked patties to a plate. Carefully wipe the skillet clean to remove excess grease or browned residue.
Spread 1 teaspoon of mayonnaise over one side of each slice of rye bread.
Place three slices of bread in the skillet with the mayonnaise-coated sides facing down. Top each slice with one slice of Cheddar cheese, a cooked beef patty, one-third of the sautéed onions, and another slice of Cheddar.
Place the remaining bread slices on top, keeping their mayonnaise-coated sides facing upward.
Cook the sandwiches over medium heat for 3–4 minutes, until the bottom bread becomes golden brown and the cheese begins to melt.
Carefully flip each sandwich using a wide spatula. Cook for another 3–4 minutes, until both sides are crisp and golden and the cheese is fully melted.
Remove the patty melts from the skillet, slice if desired, and serve warm.