It looks as if you retrieved those values with a Select-Object cmdlet.
In that case you will get 2 object, where each of these objects stores the value under a different propertyname (Id and FolderId).
That's why the comparison returns $false.
You should compare the value of these properties, that will return $true.
This shows the difference.
$vm = Get-VM -Name MyVM
$folder = Get-Folder -Name MyFolder
$t1 = $vm | Select FolderId
$t2 = $folder | Select Id
# Returns false
$t1 -eq $t2
# Returns true
$vm.FolderId -eq $folder.Id