Melt the butter and oil (or one or the other) in a large pot over medium heat. Add the onion, garlic, and rosemary and cook for 5 minutes, until soft.
Add the potatoes, white beans, and 4 cups broth. Bring to a boil, then reduce to a gentle simmer. Cook for 15–20 minutes, until the potatoes are fork-tender.
Turn off the heat and remove the rosemary sprig, if using. Use an immersion blender to blend the soup until smooth. If it’s too thick, add more broth as needed.
Stir in the vinegar or lemon juice, then the half-and-half or cream.
With the heat OFF, add the Gruyère a handful at a time, stirring well after each addition until melted and smooth.
Season with salt and black pepper to taste. Serve with crusty bread and sink in.
