Ranking on style alone can be misleading. Although Sophie is an HRH and her husband a mere HSH, he outranked her even before they married because he was (is) an Hereditary Prince, and of a reigning house; just as he would outrank an ordinary HI&RH Archduke of Austria. Similarly, Prince Hans Adam, a Reigning Prince, outranks Prince Ernst August, the Head of the Royal House of Hanover.
Princess May of Teck was looked down upon by both the Germans (because the Tecks were a morganatic branch), and by her British royal cousins (because she was only a Serene Highness). She did, however, have the last laugh in 1910 when as Queen Mary she became a Queen Empress, and with a few exceptions outranked them all.
Organising ranking and precedence within a gathering of members of reigning and non-reigning Imperial, Royal, Princely and Mediatised Houses must be a nightmare for the host of a function. Prior to the First World War most Courts, big and small, had their resident experts who would work through the intricacies to ensure everyone was in their rightful place, and to keep to a minimum the inevitable number of noses out of joint.
Within the Gotha [the Noble caste] these days the distinction between reigning and non-reigning at private events may not be an issue; the ranking is more likely to be based on the order as it was prior to 1918.
Getting back to Sophie, which is where we started (thanks Kerry

), the policy of the German government or German law is irrelevant. Those who acknowledge her as a Royal Highness and Princess of/Duchess in Bavaria will do so irrespective of whether the State recognises such distinctions or not.