Before relenting, Budapest had threatened to allow billions of dollars to flow back to the Kremlin in a row over energy imports.