Below is the minimum example of the model I am able to solve. Why is the constraint @constraint(model, Cost == (x-y)*z) allowed in Gurobi? Isn’t it nonlinear?

using JuMP
using Gurobi
model = Model(with_optimizer(Gurobi.Optimizer))
@variable(model, 100>= x >=0)
@variable(model, 100>= y >=0)
@variable(model, z, binary = true)
Cost = @variable(model, Cost)
@constraint(model, Cost == (x-y)*z)
@objective(model, Min, x + Cost)
JuMP.optimize!(model)

Gurobi supports quadratic constraints and objectives. In this case, it is even able to reformulate your model into a mixed-integer linear program. However, Gurobi is still able to solve non-convex quadratic programs. You may be interested in watching https://www.gurobi.com/resource/non-convex-quadratic-optimization/.