BUG: groupby.rank with MaskedArray incorrect casting
- [ ] closes #xxxx
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [ ] whatsnew entry

In master:
```
df = pd.DataFrame({"key": ["a"] * 4, "val": [1] * 4})
df["val"] = df["val"].astype("Int64")

>>> result = df.groupby("key").rank()
TypeError: cannot safely cast non-equivalent float64 to int64
```

Moves in the direction of sharing/generalizing _ea_wrap_cython_operation.

If I did this right, should avoid overlap with #40651.