Heat 2 tablespoons butter in a skillet over medium heat. Add onions and sauté until translucent and lightly golden. Remove from pan and set aside.
Form ground beef into a patty sized to fit the rye bread slices. Season with salt and pepper.
Cook the patty in the same skillet to desired doneness. Remove and set aside.
Butter one side of each bread slice with remaining butter.
Place one slice of bread butter-side down on hot griddle or skillet.
Layer one slice of cheese, caramelized onions, cooked patty, and second slice of cheese on top.
Top with second bread slice, butter-side facing out.
Grill until bread is golden and crispy but not burned, approximately 3-4 minutes.
Carefully flip and grill the other side until golden and cheese is fully melted, another 3-4 minutes.
Remove from heat and slice diagonally before serving.