Magic: The Gathering, Paying for Spells
JavaScript (ES6), 91 bytes
Takes input as (cost)(lands):

\$cost\$ is a list of characters in BGRUW order, prefixed with the generic part, even when it's \$0\$
\$lands\$ is a list of strings.


a=&gt;g=([c,...r],n=0,s=e='')=&gt;[...n+s].sort()+e==a|(c&amp;&amp;[e,e,...c].some((c,i)=&gt;g(r,n+!i,s+c)))

Try it online!
Commented
a =&gt;                        // main function taking the array a[] describing the cost
  g = (                     // g = recursive function taking:
    [c, ...r],              //   c = next land string; r[] = remaining land strings
    n = 0,                  //   n = generic mana, initialized to 0
    s = e = ''              //   s = generated cost string, initialized to e = empty string
  ) =&gt;                      //
    [...n + s].sort() + e   // prepend n to s, split, sort and force coercion to a string
    == a | (                // if this is matching a[], the test is successful
      c &amp;&amp;                  // if c is defined:
      [                     //   try the following recursive calls:
        e,                  //     - increment n and append nothing to s
        e,                  //     - do nothing
        ...c                //     - leave n unchanged and append a character to s
      ].some((c, i) =&gt;      //   for each c at position i in the above array:
        g(r, n + !i, s + c) //     process the recursive call
      )                     //   end of some()
    )                       // end of the recursive part