To solve the optimization problem described, we first need to define the decision variables and the objective function. Let's denote:

- \(x_r\) as the number of regular donuts purchased,
- \(x_j\) as the number of jelly-filled donuts purchased.

The profit per regular donut is $2, and per jelly-filled donut is $3. The cost for each regular donut is $4, and for each jelly-filled donut is $6. Thus, the revenue from selling a regular donut is $4 (cost) + $2 (profit) = $6, but since we are considering profit, we directly use the profit values in our objective function.

The objective function to maximize the total monthly profit can be written as:
\[ \text{Maximize:} \quad 2x_r + 3x_j \]

Given constraints:
1. The store expects to sell at most 1000 donuts:
\[ x_r + x_j \leq 1000 \]
2. The store wants to spend at most $5000 in buying donuts from the bakery:
\[ 4x_r + 6x_j \leq 5000 \]

Additionally, \(x_r \geq 0\) and \(x_j \geq 0\), since we cannot buy a negative number of donuts.

Now, translating this problem into Gurobi code in Python:

```python
from gurobipy import *

# Create a new model
m = Model("donut_optimization")

# Define the decision variables
x_r = m.addVar(vtype=GRB.CONTINUOUS, name="regular_donuts")
x_j = m.addVar(vtype=GRB.CONTINUOUS, name="jelly_filled_donuts")

# Set the objective function to maximize profit
m.setObjective(2*x_r + 3*x_j, GRB.MAXIMIZE)

# Add constraints
m.addConstr(x_r + x_j <= 1000, "total_donuts")
m.addConstr(4*x_r + 6*x_j <= 5000, "budget")

# Solve the model
m.optimize()

# Print the results
if m.status == GRB.OPTIMAL:
    print("Optimal solution found:")
    print(f"Regular donuts: {x_r.x}")
    print(f"Jelly-filled donuts: {x_j.x}")
    print(f"Maximum profit: {m.objVal}")
else:
    print("No optimal solution found")
```