One thing to check is how your rule evaluates the query string. Note that the query string is not evaluated by the rule's pattern, instead it should be evaluated in a rule's condition by using {QUERY_STRING} server variable, e.g.:
<rule name="redirect" stopProcessing="true">
<match url="^buying/search/details\.aspx$" />
<conditions>
<add input="{QUERY_STRING}" pattern="^id=([0-9]+)$" />
</conditions>
<action type="Redirect" url="Search.aspx?mls={C:1}" redirectType="Permanent" />
</rule>