Combining custom field filters on craft.entries
It's currently not possible to combine criteria params like this (see Complex logic on a ElementCriteriaModel parameter?).
As a workaround you'd prepare an idParam object, similar to your relatedToParam and collect all matching element IDs
making use of additional criteria models and the ids method.

{# Prep the id param #}
{% set idParam = [] %}

{% if formats is null %}
    {% set ebookEntryIds = craft.entries({
        section: 'books',
        ebookRrp: 'and, &gt; '~price_from~', &lt; '~price_to
    }).ids() %}

    {% set pbackEntryIds = craft.entries({
        section: 'books',
        paperbackRrp: 'and, &gt; '~price_from~', &lt; '~price_to
    }).ids() %}

    {% set idParam = ebookEntryIds|merge(pbackEntryIds) %}
{% endif %}

{# Merge in the id param #}
{% if idParam|length %}
    {% set params = params|merge({ id: idParam }) %}
{% endif %}