I don't have an answer to why it happens but to avoid such instances, be explicit. Use the Type (dynamic) Parameter and specify a RegistryValueKind value (you can also use it with New-ItemProperty
) :
Set-ItemProperty -Path HKCR:\Software\MyCompany -Name Level -Value 5 -Type DWord