Scale object in place keeping its origin
Matrix equivalent of global scale bounding box center.

Note both of these examples use the bounding box center as pivot point.

Could as suggested scale the mesh, akin to edit mode scale.  If scaling the mesh  use local coordinates. Note this alters the mesh coordinates, but keeps the origin and object global translation same.

To scale about a non origin point, first translate such that pivot point is origin, then scale, then move back.

import bpy
from mathutils import Matrix, Vector

context = bpy.context

scale = (2, 2, 1)

ob = context.object

bbox = [Vector(b) for b in ob.bound_box]
o = sum(bbox, Vector()) / 8


T = Matrix.Translation(o)
S = Matrix.Diagonal(scale).to_4x4()
T2 = Matrix.Translation(-o)

M = T @ S @ T2

ob.data.transform(M)
ob.data.update()


And a global version. 

Make a scale matrix and two translation matrices, one to make scale origin bounding box global center, the other to move it back.

Note this will not alter the mesh or its origin, but will translate the object to match the scale, to give object appearance of scaling in place. 

import bpy
from mathutils import Matrix, Vector

context = bpy.context

scale = (2, 2, 1)

ob = context.object
mw = ob.matrix_world
bbox = [Vector(b) for b in ob.bound_box]
go = mw @ sum(bbox, Vector()) / 8



T = Matrix.Translation(go)
S = Matrix.Diagonal(scale).to_4x4()
T2 = Matrix.Translation(-go)

M = T @ S @ T2

ob.matrix_world = M @ ob.matrix_world