Mix the flour, 1/2 teaspoon salt, baking powder, and pepper together in a bowl. Place the potatoes and onion in a large bowl, and stir in the flour mixture until thoroughly blended. Use floured hands to knead the potato mixture in the bowl until it takes on the quality of stiff bread dough. Add additional flour if the dough is too sticky.
Pinch off a tennis ball-sized piece of dough and shape it around a cube of ham, completely covering the ham, to form a ball. Repeat with remaining dough and ham cubes. Set aside any extra ham.
Fill a large pot with water, add 2 teaspoons salt and any extra ham, and bring to a boil over medium-high heat. Carefully slide the balls into the boiling water, a few at a time. Loosen any sticking to the bottom of the pot. Simmer for 45 minutes to 1 hour. Remove with a slotted spoon, and drain on a plate. Serve hot with melted butter.