Why is the former better? Because if you run the latter stylesheet through a processor, you’ll get:
<xsl:value-of select="for $p in products return if ($p/@price) then xs:decimal($p/@price) else (xs:decimal($p/@cost) * 1.5)"/>
Which I find a little hard to read. My recommendation: use XSLT whenever you can.