I just tested the above code in 4.0.4 and it's showing the right price. Perhaps you inserted the php code in the wrong place?
For 4.0.4 I inserted it into recommends.php (in x-cart directory) after this code:
Code:
if ($config["Modules"]["select_recommends_list_randomly"] == "Y" && count($query_ids)>0) {
$query = "SELECT $sql_tbl[products].*, $lng_fields FROM $sql_tbl[products] LEFT JOIN $sql_tbl[products_lng] ON $sql_tbl[products].productid=$sql_tbl[products_lng].productid $lng_condition WHERE $sql_tbl[products].productid IN ('".join("','",$query_ids)."')";
See if that helps!
Carrie